From 4214022d036f45d9f4fd5cfa8a17e02841238977 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Tue, 12 Sep 2023 16:46:42 +0800 Subject: [PATCH 1/6] disables sample generation in private dns since it was disabled previously and is enabled accidentally --- .../Azure.ResourceManager.PrivateDns/src/autorest.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md index 2be94ed1f021..b4d3521f0592 100644 --- a/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md +++ b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/autorest.md @@ -14,6 +14,7 @@ clear-output-folder: true sample-gen: output-folder: $(this-folder)/../samples/Generated clear-output-folder: true + sample: false skip-csproj: true modelerfour: flatten-payloads: false @@ -28,7 +29,7 @@ format-by-name-rules: 'ifMatch': 'etag' 'IPv6Address': 'ip-address' 'IPv4Address': 'ip-address' - + acronym-mapping: CPU: Cpu CPUs: Cpus @@ -59,7 +60,7 @@ acronym-mapping: SoaRecord: PrivateDnsSoaRecordInfo SrvRecord: PrivateDnsSrvRecordInfo TxtRecord: PrivateDnsTxtRecordInfo - ProvisioningState : PrivateDnsProvisioningState + ProvisioningState : PrivateDnsProvisioningState override-operation-name: RecordSets_List: GetRecords From d69dd00f94ac705bcc2e24edb5202ac4265638a4 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Tue, 12 Sep 2023 17:14:31 +0800 Subject: [PATCH 2/6] fix some config issues --- .../src/autorest.md | 2 - .../Samples/Sample_ArmResourceExtensions.cs | 44 +++++++++++++++++++ .../Azure.ResourceManager.Dns/src/autorest.md | 1 + 3 files changed, 45 insertions(+), 2 deletions(-) create mode 100644 sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs diff --git a/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md b/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md index e0867a569090..3d400e29b0c7 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/autorest.md @@ -16,8 +16,6 @@ clear-output-folder: true sample-gen: output-folder: $(this-folder)/../samples/Generated clear-output-folder: true - skipped-operations: - - EligibleChildResources_Get skip-csproj: true modelerfour: flatten-payloads: false diff --git a/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs new file mode 100644 index 000000000000..cd8ab4c9bd34 --- /dev/null +++ b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Authorization.Models; + +namespace Azure.ResourceManager.Authorization.Samples +{ + public partial class Sample_ArmResourceExtensions + { + // GetEligibleChildResourcesByScope + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetEligibleChildResources_GetEligibleChildResourcesByScope() + { + // Generated from example definition: specification/authorization/resource-manager/Microsoft.Authorization/stable/2020-10-01/examples/GetEligibleChildResourcesByScope.json + // this example is just showing the usage of "EligibleChildResources_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // invoke the operation and iterate over the result + string scope = "providers/Microsoft.Subscription/subscriptions/dfa2a084-766f-4003-8ae1-c4aeb893a99f"; + ResourceIdentifier scope0 = new ResourceIdentifier(string.Format("/{0}", scope)); + string filter = "resourceType+eq+'resourcegroup'"; + await foreach (EligibleChildResource item in client.GetEligibleChildResourcesAsync(scope0, filter: filter)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md b/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md index 0b97d5d0df96..80147fdbf72a 100644 --- a/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md +++ b/sdk/dns/Azure.ResourceManager.Dns/src/autorest.md @@ -12,6 +12,7 @@ clear-output-folder: true sample-gen: output-folder: $(this-folder)/../samples/Generated clear-output-folder: true + sample: false skip-csproj: true modelerfour: flatten-payloads: false From 14ad1f2f2ce195ba6c25d8871f8d4e7c27f7d8a9 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Tue, 12 Sep 2023 17:15:03 +0800 Subject: [PATCH 3/6] remove the Samples directory since it is capitalized --- ...ourceManager.SecurityDevOps.Samples.csproj | 10 - .../Sample_AzureDevOpsConnectorCollection.cs | 182 --------------- .../Sample_AzureDevOpsConnectorResource.cs | 216 ------------------ .../Sample_AzureDevOpsOrgCollection.cs | 167 -------------- .../Samples/Sample_AzureDevOpsOrgResource.cs | 93 -------- .../Sample_AzureDevOpsProjectCollection.cs | 171 -------------- .../Sample_AzureDevOpsProjectResource.cs | 95 -------- .../Sample_AzureDevOpsRepoCollection.cs | 192 ---------------- .../Samples/Sample_AzureDevOpsRepoResource.cs | 90 -------- .../Sample_GitHubConnectorCollection.cs | 164 ------------- .../Samples/Sample_GitHubConnectorResource.cs | 216 ------------------ .../Samples/Sample_GitHubOwnerCollection.cs | 160 ------------- .../Samples/Sample_GitHubOwnerResource.cs | 86 ------- .../Samples/Sample_GitHubRepoCollection.cs | 164 ------------- .../Samples/Sample_GitHubRepoResource.cs | 88 ------- 15 files changed, 2094 deletions(-) delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorResource.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerResource.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoCollection.cs delete mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoResource.cs diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj deleted file mode 100644 index 5ed002d2e594..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs deleted file mode 100644 index a597489deb85..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs +++ /dev/null @@ -1,182 +0,0 @@ -// 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.Resources; -using Azure.ResourceManager.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsConnectorCollection - { - // AzureDevOpsConnector_ListByResourceGroup - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_AzureDevOpsConnectorListByResourceGroup() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorListByResourceGroup.json - // this example is just showing the usage of "AzureDevOpsConnector_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 - 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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this AzureDevOpsConnectorResource - AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsConnectorResource 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 - AzureDevOpsConnectorData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsConnector_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsConnectorGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json - // this example is just showing the usage of "AzureDevOpsConnector_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this AzureDevOpsConnectorResource - AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); - - // invoke the operation - string azureDevOpsConnectorName = "testconnector"; - AzureDevOpsConnectorResource result = await collection.GetAsync(azureDevOpsConnectorName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - AzureDevOpsConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsConnector_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_AzureDevOpsConnectorGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json - // this example is just showing the usage of "AzureDevOpsConnector_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this AzureDevOpsConnectorResource - AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); - - // invoke the operation - string azureDevOpsConnectorName = "testconnector"; - bool result = await collection.ExistsAsync(azureDevOpsConnectorName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // AzureDevOpsConnector_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_AzureDevOpsConnectorCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorCreateOrUpdate.json - // this example is just showing the usage of "AzureDevOpsConnector_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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this AzureDevOpsConnectorResource - AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); - - // invoke the operation - string azureDevOpsConnectorName = "testconnector"; - AzureDevOpsConnectorData data = new AzureDevOpsConnectorData(new AzureLocation("West US")) - { - Properties = new AzureDevOpsConnectorProperties() - { - AuthorizationCode = "00000000000000000000", - Orgs = -{ -new AzureDevOpsOrgMetadata() -{ -Name = "testOrg", -Projects = -{ -new AzureDevOpsProjectMetadata() -{ -Name = "testProject", -Repos = -{ -"testRepo" -}, -} -}, -} -}, - }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsConnectorName, data); - AzureDevOpsConnectorResource 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 - AzureDevOpsConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs deleted file mode 100644 index 6231111122db..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs +++ /dev/null @@ -1,216 +0,0 @@ -// 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.Resources; -using Azure.ResourceManager.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsConnectorResource - { - // AzureDevOpsConnector_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsConnectorGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json - // this example is just showing the usage of "AzureDevOpsConnector_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // invoke the operation - AzureDevOpsConnectorResource result = await azureDevOpsConnector.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 - AzureDevOpsConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsConnector_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_AzureDevOpsConnectorUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorUpdate.json - // this example is just showing the usage of "AzureDevOpsConnector_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 AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // invoke the operation - AzureDevOpsConnectorData data = new AzureDevOpsConnectorData(new AzureLocation("West US")) - { - Tags = -{ -["client"] = "dev-client", -["env"] = "dev", -}, - }; - ArmOperation lro = await azureDevOpsConnector.UpdateAsync(WaitUntil.Completed, data); - AzureDevOpsConnectorResource 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 - AzureDevOpsConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsConnector_Delete - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_AzureDevOpsConnectorDelete() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorDelete.json - // this example is just showing the usage of "AzureDevOpsConnector_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 AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // invoke the operation - await azureDevOpsConnector.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsConnector_ListBySubscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAzureDevOpsConnectors_AzureDevOpsConnectorListBySubscription() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorListBySubscription.json - // this example is just showing the usage of "AzureDevOpsConnector_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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // 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 = "00000000-0000-0000-0000-000000000000"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsConnectorResource item in subscriptionResource.GetAzureDevOpsConnectorsAsync()) - { - // 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 - AzureDevOpsConnectorData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsRepo_ListByConnector - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAzureDevOpsReposByConnector_AzureDevOpsRepoListByConnector() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoListByConnector.json - // this example is just showing the usage of "AzureDevOpsRepo_ListByConnector" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsRepoResource item in azureDevOpsConnector.GetAzureDevOpsReposByConnectorAsync()) - { - // 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 - AzureDevOpsRepoData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsConnectorStats_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAzureDevOpsConnectorStats_AzureDevOpsConnectorStatsGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorStatsGet.json - // this example is just showing the usage of "AzureDevOpsConnectorStats_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsConnectorStats item in azureDevOpsConnector.GetAzureDevOpsConnectorStatsAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs deleted file mode 100644 index 201e3fc4d808..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsOrgCollection - { - // AzureDevOpsOrg_List - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_AzureDevOpsOrgList() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgList.json - // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // get the collection of this AzureDevOpsOrgResource - AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsOrgResource 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 - AzureDevOpsOrgData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsOrg_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsOrgGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json - // this example is just showing the usage of "AzureDevOpsOrg_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // get the collection of this AzureDevOpsOrgResource - AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); - - // invoke the operation - string azureDevOpsOrgName = "myOrg"; - AzureDevOpsOrgResource result = await collection.GetAsync(azureDevOpsOrgName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - AzureDevOpsOrgData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsOrg_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_AzureDevOpsOrgGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json - // this example is just showing the usage of "AzureDevOpsOrg_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // get the collection of this AzureDevOpsOrgResource - AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); - - // invoke the operation - string azureDevOpsOrgName = "myOrg"; - bool result = await collection.ExistsAsync(azureDevOpsOrgName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // AzureDevOpsOrg_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_AzureDevOpsOrgCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgCreateOrUpdate.json - // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsConnectorResource created on azure - // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); - AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); - - // get the collection of this AzureDevOpsOrgResource - AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); - - // invoke the operation - string azureDevOpsOrgName = "myOrg"; - AzureDevOpsOrgData data = new AzureDevOpsOrgData() - { - Properties = new AzureDevOpsOrgProperties() - { - AutoDiscovery = AutoDiscovery.Disabled, - }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsOrgName, data); - AzureDevOpsOrgResource 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 - AzureDevOpsOrgData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs deleted file mode 100644 index b8a079c8e86f..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsOrgResource - { - // AzureDevOpsOrg_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsOrgGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json - // this example is just showing the usage of "AzureDevOpsOrg_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsOrgResource created on azure - // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); - AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); - - // invoke the operation - AzureDevOpsOrgResource result = await azureDevOpsOrg.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 - AzureDevOpsOrgData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsOrg_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_AzureDevOpsOrgUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgUpdate.json - // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsOrgResource created on azure - // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); - AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); - - // invoke the operation - AzureDevOpsOrgData data = new AzureDevOpsOrgData() - { - Properties = new AzureDevOpsOrgProperties() - { - AutoDiscovery = AutoDiscovery.Disabled, - }, - }; - ArmOperation lro = await azureDevOpsOrg.UpdateAsync(WaitUntil.Completed, data); - AzureDevOpsOrgResource 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 - AzureDevOpsOrgData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs deleted file mode 100644 index 2cab02189181..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs +++ /dev/null @@ -1,171 +0,0 @@ -// 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.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsProjectCollection - { - // AzureDevOpsProject_List - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_AzureDevOpsProjectList() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectList.json - // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsOrgResource created on azure - // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); - AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); - - // get the collection of this AzureDevOpsProjectResource - AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsProjectResource 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 - AzureDevOpsProjectData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsProject_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsProjectGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json - // this example is just showing the usage of "AzureDevOpsProject_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsOrgResource created on azure - // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); - AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); - - // get the collection of this AzureDevOpsProjectResource - AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); - - // invoke the operation - string azureDevOpsProjectName = "myProject"; - AzureDevOpsProjectResource result = await collection.GetAsync(azureDevOpsProjectName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - AzureDevOpsProjectData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsProject_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_AzureDevOpsProjectGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json - // this example is just showing the usage of "AzureDevOpsProject_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsOrgResource created on azure - // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); - AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); - - // get the collection of this AzureDevOpsProjectResource - AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); - - // invoke the operation - string azureDevOpsProjectName = "myProject"; - bool result = await collection.ExistsAsync(azureDevOpsProjectName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // AzureDevOpsProject_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_AzureDevOpsProjectCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectCreateOrUpdate.json - // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsOrgResource created on azure - // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); - AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); - - // get the collection of this AzureDevOpsProjectResource - AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); - - // invoke the operation - string azureDevOpsProjectName = "myProject"; - AzureDevOpsProjectData data = new AzureDevOpsProjectData() - { - Properties = new AzureDevOpsProjectProperties() - { - AutoDiscovery = AutoDiscovery.Disabled, - }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsProjectName, data); - AzureDevOpsProjectResource 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 - AzureDevOpsProjectData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs deleted file mode 100644 index ac8922d628db..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs +++ /dev/null @@ -1,95 +0,0 @@ -// 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.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsProjectResource - { - // AzureDevOpsProject_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsProjectGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json - // this example is just showing the usage of "AzureDevOpsProject_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsProjectResource created on azure - // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); - AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); - - // invoke the operation - AzureDevOpsProjectResource result = await azureDevOpsProject.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 - AzureDevOpsProjectData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsProject_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_AzureDevOpsProjectUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectUpdate.json - // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsProjectResource created on azure - // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); - AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); - - // invoke the operation - AzureDevOpsProjectData data = new AzureDevOpsProjectData() - { - Properties = new AzureDevOpsProjectProperties() - { - AutoDiscovery = AutoDiscovery.Disabled, - }, - }; - ArmOperation lro = await azureDevOpsProject.UpdateAsync(WaitUntil.Completed, data); - AzureDevOpsProjectResource 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 - AzureDevOpsProjectData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs deleted file mode 100644 index 04471e6e5b70..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs +++ /dev/null @@ -1,192 +0,0 @@ -// 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.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsRepoCollection - { - // AzureDevOpsRepo_List - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_AzureDevOpsRepoList() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoList.json - // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsProjectResource created on azure - // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); - AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); - - // get the collection of this AzureDevOpsRepoResource - AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); - - // invoke the operation and iterate over the result - await foreach (AzureDevOpsRepoResource 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 - AzureDevOpsRepoData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // AzureDevOpsRepo_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsRepoGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json - // this example is just showing the usage of "AzureDevOpsRepo_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsProjectResource created on azure - // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); - AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); - - // get the collection of this AzureDevOpsRepoResource - AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); - - // invoke the operation - string azureDevOpsRepoName = "myRepo"; - AzureDevOpsRepoResource result = await collection.GetAsync(azureDevOpsRepoName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - AzureDevOpsRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsRepo_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_AzureDevOpsRepoGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json - // this example is just showing the usage of "AzureDevOpsRepo_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsProjectResource created on azure - // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); - AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); - - // get the collection of this AzureDevOpsRepoResource - AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); - - // invoke the operation - string azureDevOpsRepoName = "myRepo"; - bool result = await collection.ExistsAsync(azureDevOpsRepoName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // AzureDevOpsRepo_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_AzureDevOpsRepoCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoCreateOrUpdate.json - // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsProjectResource created on azure - // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); - AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); - - // get the collection of this AzureDevOpsRepoResource - AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); - - // invoke the operation - string azureDevOpsRepoName = "myRepo"; - AzureDevOpsRepoData data = new AzureDevOpsRepoData() - { - Properties = new AzureDevOpsRepoProperties() - { - RepoId = "00000000-0000-0000-0000-000000000000", - RepoUri = new Uri("https://dev.azure.com/myOrg/myProject/_git/myRepo"), - ActionableRemediation = new ActionableRemediation() - { - State = ActionableRemediationState.Enabled, - SeverityLevels = -{ -"High" -}, - Categories = -{ -ActionableRemediationRuleCategory.Secrets -}, - BranchNames = -{ -"main" -}, - }, - }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsRepoName, data); - AzureDevOpsRepoResource 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 - AzureDevOpsRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs deleted file mode 100644 index 37da7ef97f28..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs +++ /dev/null @@ -1,90 +0,0 @@ -// 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.SecurityDevOps; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_AzureDevOpsRepoResource - { - // AzureDevOpsRepo_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_AzureDevOpsRepoGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json - // this example is just showing the usage of "AzureDevOpsRepo_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this AzureDevOpsRepoResource created on azure - // for more information of creating AzureDevOpsRepoResource, please refer to the document of AzureDevOpsRepoResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - string azureDevOpsRepoName = "myRepo"; - ResourceIdentifier azureDevOpsRepoResourceId = AzureDevOpsRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName, azureDevOpsRepoName); - AzureDevOpsRepoResource azureDevOpsRepo = client.GetAzureDevOpsRepoResource(azureDevOpsRepoResourceId); - - // invoke the operation - AzureDevOpsRepoResource result = await azureDevOpsRepo.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 - AzureDevOpsRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // AzureDevOpsRepo_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_AzureDevOpsRepoUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoUpdate.json - // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsRepoResource created on azure - // for more information of creating AzureDevOpsRepoResource, please refer to the document of AzureDevOpsRepoResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string azureDevOpsConnectorName = "testconnector"; - string azureDevOpsOrgName = "myOrg"; - string azureDevOpsProjectName = "myProject"; - string azureDevOpsRepoName = "myRepo"; - ResourceIdentifier azureDevOpsRepoResourceId = AzureDevOpsRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName, azureDevOpsRepoName); - AzureDevOpsRepoResource azureDevOpsRepo = client.GetAzureDevOpsRepoResource(azureDevOpsRepoResourceId); - - // invoke the operation - AzureDevOpsRepoData data = new AzureDevOpsRepoData(); - ArmOperation lro = await azureDevOpsRepo.UpdateAsync(WaitUntil.Completed, data); - AzureDevOpsRepoResource 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 - AzureDevOpsRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorCollection.cs deleted file mode 100644 index 1bb50c0ac1e1..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorCollection.cs +++ /dev/null @@ -1,164 +0,0 @@ -// 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.Resources; -using Azure.ResourceManager.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_GitHubConnectorCollection - { - // GitHubConnector_ListByResourceGroup - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GitHubConnectorListByResourceGroup() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorListByResourceGroup.json - // this example is just showing the usage of "GitHubConnector_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 - 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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this GitHubConnectorResource - GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); - - // invoke the operation and iterate over the result - await foreach (GitHubConnectorResource 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 - GitHubConnectorData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GitHubConnector_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GitHubConnectorGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json - // this example is just showing the usage of "GitHubConnector_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this GitHubConnectorResource - GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); - - // invoke the operation - string gitHubConnectorName = "testconnector"; - GitHubConnectorResource result = await collection.GetAsync(gitHubConnectorName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - GitHubConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubConnector_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_GitHubConnectorGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json - // this example is just showing the usage of "GitHubConnector_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this GitHubConnectorResource - GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); - - // invoke the operation - string gitHubConnectorName = "testconnector"; - bool result = await collection.ExistsAsync(gitHubConnectorName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // GitHubConnector_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_GitHubConnectorCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorCreateOrUpdate.json - // this example is just showing the usage of "GitHubConnector_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 = "westusrg"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this GitHubConnectorResource - GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); - - // invoke the operation - string gitHubConnectorName = "testconnector"; - GitHubConnectorData data = new GitHubConnectorData(new AzureLocation("West US")) - { - Properties = new GitHubConnectorProperties() - { - Code = "00000000000000000000", - }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, gitHubConnectorName, data); - GitHubConnectorResource 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 - GitHubConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorResource.cs deleted file mode 100644 index bafff957f85b..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubConnectorResource.cs +++ /dev/null @@ -1,216 +0,0 @@ -// 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.Resources; -using Azure.ResourceManager.SecurityDevOps; -using Azure.ResourceManager.SecurityDevOps.Models; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_GitHubConnectorResource - { - // GitHubConnector_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GitHubConnectorGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json - // this example is just showing the usage of "GitHubConnector_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // invoke the operation - GitHubConnectorResource result = await gitHubConnector.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 - GitHubConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubConnector_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_GitHubConnectorUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorUpdate.json - // this example is just showing the usage of "GitHubConnector_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 GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // invoke the operation - GitHubConnectorData data = new GitHubConnectorData(new AzureLocation("West US")) - { - Tags = -{ -["client"] = "dev-client", -["env"] = "dev", -}, - }; - ArmOperation lro = await gitHubConnector.UpdateAsync(WaitUntil.Completed, data); - GitHubConnectorResource 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 - GitHubConnectorData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubConnector_Delete - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_GitHubConnectorDelete() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorDelete.json - // this example is just showing the usage of "GitHubConnector_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 GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // invoke the operation - await gitHubConnector.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine($"Succeeded"); - } - - // GitHubConnector_ListBySubscription - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetGitHubConnectors_GitHubConnectorListBySubscription() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorListBySubscription.json - // this example is just showing the usage of "GitHubConnector_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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // 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 = "00000000-0000-0000-0000-000000000000"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation and iterate over the result - await foreach (GitHubConnectorResource item in subscriptionResource.GetGitHubConnectorsAsync()) - { - // 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 - GitHubConnectorData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GitHubRepo_ListByConnector - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetGitHubReposByConnector_GitHubRepoListByConnector() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoListByConnector.json - // this example is just showing the usage of "GitHubRepo_ListByConnector" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // invoke the operation and iterate over the result - await foreach (GitHubRepoResource item in gitHubConnector.GetGitHubReposByConnectorAsync()) - { - // 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 - GitHubRepoData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GitHubConnectorStats_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetGitHubConnectorStats_GitHubConnectorStatsGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorStatsGet.json - // this example is just showing the usage of "GitHubConnectorStats_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // invoke the operation and iterate over the result - await foreach (GitHubConnectorStats item in gitHubConnector.GetGitHubConnectorStatsAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine($"Succeeded"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerCollection.cs deleted file mode 100644 index 48ea3172edeb..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerCollection.cs +++ /dev/null @@ -1,160 +0,0 @@ -// 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.SecurityDevOps; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_GitHubOwnerCollection - { - // GitHubOwner_List - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GitHubOwnerList() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerList.json - // this example is just showing the usage of "GitHubOwner_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 GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // get the collection of this GitHubOwnerResource - GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); - - // invoke the operation and iterate over the result - await foreach (GitHubOwnerResource 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 - GitHubOwnerData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GitHubOwner_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GitHubOwnerGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json - // this example is just showing the usage of "GitHubOwner_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // get the collection of this GitHubOwnerResource - GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); - - // invoke the operation - string gitHubOwnerName = "Azure"; - GitHubOwnerResource result = await collection.GetAsync(gitHubOwnerName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - GitHubOwnerData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubOwner_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_GitHubOwnerGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json - // this example is just showing the usage of "GitHubOwner_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // get the collection of this GitHubOwnerResource - GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); - - // invoke the operation - string gitHubOwnerName = "Azure"; - bool result = await collection.ExistsAsync(gitHubOwnerName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // GitHubOwner_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_GitHubOwnerCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerCreateOrUpdate.json - // this example is just showing the usage of "GitHubOwner_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 GitHubConnectorResource created on azure - // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); - GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); - - // get the collection of this GitHubOwnerResource - GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); - - // invoke the operation - string gitHubOwnerName = "Azure"; - GitHubOwnerData data = new GitHubOwnerData(); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, gitHubOwnerName, data); - GitHubOwnerResource 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 - GitHubOwnerData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerResource.cs deleted file mode 100644 index 55dea9a913fe..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubOwnerResource.cs +++ /dev/null @@ -1,86 +0,0 @@ -// 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.SecurityDevOps; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_GitHubOwnerResource - { - // GitHubOwner_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GitHubOwnerGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json - // this example is just showing the usage of "GitHubOwner_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubOwnerResource created on azure - // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); - GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); - - // invoke the operation - GitHubOwnerResource result = await gitHubOwner.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 - GitHubOwnerData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubOwner_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_GitHubOwnerUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerUpdate.json - // this example is just showing the usage of "GitHubOwner_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 GitHubOwnerResource created on azure - // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); - GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); - - // invoke the operation - GitHubOwnerData data = new GitHubOwnerData(); - ArmOperation lro = await gitHubOwner.UpdateAsync(WaitUntil.Completed, data); - GitHubOwnerResource 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 - GitHubOwnerData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoCollection.cs deleted file mode 100644 index ae10a7634bf8..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoCollection.cs +++ /dev/null @@ -1,164 +0,0 @@ -// 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.SecurityDevOps; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_GitHubRepoCollection - { - // GitHubRepo_List - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_GitHubRepoList() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoList.json - // this example is just showing the usage of "GitHubRepo_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 GitHubOwnerResource created on azure - // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); - GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); - - // get the collection of this GitHubRepoResource - GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); - - // invoke the operation and iterate over the result - await foreach (GitHubRepoResource 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 - GitHubRepoData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine($"Succeeded"); - } - - // GitHubRepo_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GitHubRepoGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json - // this example is just showing the usage of "GitHubRepo_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubOwnerResource created on azure - // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); - GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); - - // get the collection of this GitHubRepoResource - GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); - - // invoke the operation - string gitHubRepoName = "39093389"; - GitHubRepoResource result = await collection.GetAsync(gitHubRepoName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - GitHubRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubRepo_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_GitHubRepoGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json - // this example is just showing the usage of "GitHubRepo_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubOwnerResource created on azure - // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); - GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); - - // get the collection of this GitHubRepoResource - GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); - - // invoke the operation - string gitHubRepoName = "39093389"; - bool result = await collection.ExistsAsync(gitHubRepoName); - - Console.WriteLine($"Succeeded: {result}"); - } - - // GitHubRepo_CreateOrUpdate - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_GitHubRepoCreateOrUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoCreateOrUpdate.json - // this example is just showing the usage of "GitHubRepo_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 GitHubOwnerResource created on azure - // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); - GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); - - // get the collection of this GitHubRepoResource - GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); - - // invoke the operation - string gitHubRepoName = "azure-rest-api-specs"; - GitHubRepoData data = new GitHubRepoData(); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, gitHubRepoName, data); - GitHubRepoResource 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 - GitHubRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoResource.cs deleted file mode 100644 index 3b8acf137aad..000000000000 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Samples/Generated/Samples/Sample_GitHubRepoResource.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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.SecurityDevOps; - -namespace Azure.ResourceManager.SecurityDevOps.Samples -{ - public partial class Sample_GitHubRepoResource - { - // GitHubRepo_Get - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_GitHubRepoGet() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json - // this example is just showing the usage of "GitHubRepo_Get" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this GitHubRepoResource created on azure - // for more information of creating GitHubRepoResource, please refer to the document of GitHubRepoResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - string gitHubRepoName = "39093389"; - ResourceIdentifier gitHubRepoResourceId = GitHubRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName, gitHubRepoName); - GitHubRepoResource gitHubRepo = client.GetGitHubRepoResource(gitHubRepoResourceId); - - // invoke the operation - GitHubRepoResource result = await gitHubRepo.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 - GitHubRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // GitHubRepo_Update - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_GitHubRepoUpdate() - { - // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoUpdate.json - // this example is just showing the usage of "GitHubRepo_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 GitHubRepoResource created on azure - // for more information of creating GitHubRepoResource, please refer to the document of GitHubRepoResource - string subscriptionId = "00000000-0000-0000-0000-000000000000"; - string resourceGroupName = "westusrg"; - string gitHubConnectorName = "testconnector"; - string gitHubOwnerName = "Azure"; - string gitHubRepoName = "azure-rest-api-specs"; - ResourceIdentifier gitHubRepoResourceId = GitHubRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName, gitHubRepoName); - GitHubRepoResource gitHubRepo = client.GetGitHubRepoResource(gitHubRepoResourceId); - - // invoke the operation - GitHubRepoData data = new GitHubRepoData(); - ArmOperation lro = await gitHubRepo.UpdateAsync(WaitUntil.Completed, data); - GitHubRepoResource 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 - GitHubRepoData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - } -} From d9b7a9c2836949441124be3b8e30c8df35985679 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Tue, 12 Sep 2023 17:15:47 +0800 Subject: [PATCH 4/6] introduce the sample back --- .../Sample_AzureDevOpsConnectorCollection.cs | 182 +++++++++++++++ .../Sample_AzureDevOpsConnectorResource.cs | 216 ++++++++++++++++++ .../Sample_AzureDevOpsOrgCollection.cs | 167 ++++++++++++++ .../Samples/Sample_AzureDevOpsOrgResource.cs | 93 ++++++++ .../Sample_AzureDevOpsProjectCollection.cs | 171 ++++++++++++++ .../Sample_AzureDevOpsProjectResource.cs | 95 ++++++++ .../Sample_AzureDevOpsRepoCollection.cs | 192 ++++++++++++++++ .../Samples/Sample_AzureDevOpsRepoResource.cs | 90 ++++++++ .../Sample_GitHubConnectorCollection.cs | 164 +++++++++++++ .../Samples/Sample_GitHubConnectorResource.cs | 216 ++++++++++++++++++ .../Samples/Sample_GitHubOwnerCollection.cs | 160 +++++++++++++ .../Samples/Sample_GitHubOwnerResource.cs | 86 +++++++ .../Samples/Sample_GitHubRepoCollection.cs | 164 +++++++++++++ .../Samples/Sample_GitHubRepoResource.cs | 88 +++++++ 14 files changed, 2084 insertions(+) create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorResource.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerResource.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoResource.cs diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs new file mode 100644 index 000000000000..a597489deb85 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorCollection.cs @@ -0,0 +1,182 @@ +// 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.Resources; +using Azure.ResourceManager.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsConnectorCollection + { + // AzureDevOpsConnector_ListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_AzureDevOpsConnectorListByResourceGroup() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorListByResourceGroup.json + // this example is just showing the usage of "AzureDevOpsConnector_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 + 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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureDevOpsConnectorResource + AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsConnectorResource 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 + AzureDevOpsConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json + // this example is just showing the usage of "AzureDevOpsConnector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureDevOpsConnectorResource + AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); + + // invoke the operation + string azureDevOpsConnectorName = "testconnector"; + AzureDevOpsConnectorResource result = await collection.GetAsync(azureDevOpsConnectorName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AzureDevOpsConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_AzureDevOpsConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json + // this example is just showing the usage of "AzureDevOpsConnector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureDevOpsConnectorResource + AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); + + // invoke the operation + string azureDevOpsConnectorName = "testconnector"; + bool result = await collection.ExistsAsync(azureDevOpsConnectorName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // AzureDevOpsConnector_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_AzureDevOpsConnectorCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorCreateOrUpdate.json + // this example is just showing the usage of "AzureDevOpsConnector_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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureDevOpsConnectorResource + AzureDevOpsConnectorCollection collection = resourceGroupResource.GetAzureDevOpsConnectors(); + + // invoke the operation + string azureDevOpsConnectorName = "testconnector"; + AzureDevOpsConnectorData data = new AzureDevOpsConnectorData(new AzureLocation("West US")) + { + Properties = new AzureDevOpsConnectorProperties() + { + AuthorizationCode = "00000000000000000000", + Orgs = +{ +new AzureDevOpsOrgMetadata() +{ +Name = "testOrg", +Projects = +{ +new AzureDevOpsProjectMetadata() +{ +Name = "testProject", +Repos = +{ +"testRepo" +}, +} +}, +} +}, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsConnectorName, data); + AzureDevOpsConnectorResource 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 + AzureDevOpsConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.cs new file mode 100644 index 000000000000..6231111122db --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsConnectorResource.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.Resources; +using Azure.ResourceManager.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsConnectorResource + { + // AzureDevOpsConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorGet.json + // this example is just showing the usage of "AzureDevOpsConnector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // invoke the operation + AzureDevOpsConnectorResource result = await azureDevOpsConnector.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 + AzureDevOpsConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsConnector_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AzureDevOpsConnectorUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorUpdate.json + // this example is just showing the usage of "AzureDevOpsConnector_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 AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // invoke the operation + AzureDevOpsConnectorData data = new AzureDevOpsConnectorData(new AzureLocation("West US")) + { + Tags = +{ +["client"] = "dev-client", +["env"] = "dev", +}, + }; + ArmOperation lro = await azureDevOpsConnector.UpdateAsync(WaitUntil.Completed, data); + AzureDevOpsConnectorResource 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 + AzureDevOpsConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsConnector_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_AzureDevOpsConnectorDelete() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorDelete.json + // this example is just showing the usage of "AzureDevOpsConnector_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 AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // invoke the operation + await azureDevOpsConnector.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsConnector_ListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAzureDevOpsConnectors_AzureDevOpsConnectorListBySubscription() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorListBySubscription.json + // this example is just showing the usage of "AzureDevOpsConnector_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 + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsConnectorResource item in subscriptionResource.GetAzureDevOpsConnectorsAsync()) + { + // 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 + AzureDevOpsConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsRepo_ListByConnector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAzureDevOpsReposByConnector_AzureDevOpsRepoListByConnector() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoListByConnector.json + // this example is just showing the usage of "AzureDevOpsRepo_ListByConnector" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsRepoResource item in azureDevOpsConnector.GetAzureDevOpsReposByConnectorAsync()) + { + // 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 + AzureDevOpsRepoData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsConnectorStats_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAzureDevOpsConnectorStats_AzureDevOpsConnectorStatsGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsConnectorStatsGet.json + // this example is just showing the usage of "AzureDevOpsConnectorStats_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsConnectorStats item in azureDevOpsConnector.GetAzureDevOpsConnectorStatsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs new file mode 100644 index 000000000000..201e3fc4d808 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgCollection.cs @@ -0,0 +1,167 @@ +// 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.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsOrgCollection + { + // AzureDevOpsOrg_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_AzureDevOpsOrgList() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgList.json + // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // get the collection of this AzureDevOpsOrgResource + AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsOrgResource 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 + AzureDevOpsOrgData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsOrg_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsOrgGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json + // this example is just showing the usage of "AzureDevOpsOrg_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // get the collection of this AzureDevOpsOrgResource + AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); + + // invoke the operation + string azureDevOpsOrgName = "myOrg"; + AzureDevOpsOrgResource result = await collection.GetAsync(azureDevOpsOrgName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AzureDevOpsOrgData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsOrg_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_AzureDevOpsOrgGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json + // this example is just showing the usage of "AzureDevOpsOrg_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // get the collection of this AzureDevOpsOrgResource + AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); + + // invoke the operation + string azureDevOpsOrgName = "myOrg"; + bool result = await collection.ExistsAsync(azureDevOpsOrgName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // AzureDevOpsOrg_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_AzureDevOpsOrgCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgCreateOrUpdate.json + // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsConnectorResource created on azure + // for more information of creating AzureDevOpsConnectorResource, please refer to the document of AzureDevOpsConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + ResourceIdentifier azureDevOpsConnectorResourceId = AzureDevOpsConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName); + AzureDevOpsConnectorResource azureDevOpsConnector = client.GetAzureDevOpsConnectorResource(azureDevOpsConnectorResourceId); + + // get the collection of this AzureDevOpsOrgResource + AzureDevOpsOrgCollection collection = azureDevOpsConnector.GetAzureDevOpsOrgs(); + + // invoke the operation + string azureDevOpsOrgName = "myOrg"; + AzureDevOpsOrgData data = new AzureDevOpsOrgData() + { + Properties = new AzureDevOpsOrgProperties() + { + AutoDiscovery = AutoDiscovery.Disabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsOrgName, data); + AzureDevOpsOrgResource 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 + AzureDevOpsOrgData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs new file mode 100644 index 000000000000..b8a079c8e86f --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsOrgResource.cs @@ -0,0 +1,93 @@ +// 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.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsOrgResource + { + // AzureDevOpsOrg_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsOrgGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgGet.json + // this example is just showing the usage of "AzureDevOpsOrg_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // invoke the operation + AzureDevOpsOrgResource result = await azureDevOpsOrg.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 + AzureDevOpsOrgData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsOrg_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AzureDevOpsOrgUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsOrgUpdate.json + // this example is just showing the usage of "AzureDevOpsOrg_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 AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // invoke the operation + AzureDevOpsOrgData data = new AzureDevOpsOrgData() + { + Properties = new AzureDevOpsOrgProperties() + { + AutoDiscovery = AutoDiscovery.Disabled, + }, + }; + ArmOperation lro = await azureDevOpsOrg.UpdateAsync(WaitUntil.Completed, data); + AzureDevOpsOrgResource 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 + AzureDevOpsOrgData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs new file mode 100644 index 000000000000..2cab02189181 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectCollection.cs @@ -0,0 +1,171 @@ +// 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.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsProjectCollection + { + // AzureDevOpsProject_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_AzureDevOpsProjectList() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectList.json + // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // get the collection of this AzureDevOpsProjectResource + AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsProjectResource 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 + AzureDevOpsProjectData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsProject_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsProjectGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json + // this example is just showing the usage of "AzureDevOpsProject_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // get the collection of this AzureDevOpsProjectResource + AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); + + // invoke the operation + string azureDevOpsProjectName = "myProject"; + AzureDevOpsProjectResource result = await collection.GetAsync(azureDevOpsProjectName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AzureDevOpsProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsProject_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_AzureDevOpsProjectGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json + // this example is just showing the usage of "AzureDevOpsProject_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // get the collection of this AzureDevOpsProjectResource + AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); + + // invoke the operation + string azureDevOpsProjectName = "myProject"; + bool result = await collection.ExistsAsync(azureDevOpsProjectName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // AzureDevOpsProject_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_AzureDevOpsProjectCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectCreateOrUpdate.json + // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsOrgResource created on azure + // for more information of creating AzureDevOpsOrgResource, please refer to the document of AzureDevOpsOrgResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + ResourceIdentifier azureDevOpsOrgResourceId = AzureDevOpsOrgResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName); + AzureDevOpsOrgResource azureDevOpsOrg = client.GetAzureDevOpsOrgResource(azureDevOpsOrgResourceId); + + // get the collection of this AzureDevOpsProjectResource + AzureDevOpsProjectCollection collection = azureDevOpsOrg.GetAzureDevOpsProjects(); + + // invoke the operation + string azureDevOpsProjectName = "myProject"; + AzureDevOpsProjectData data = new AzureDevOpsProjectData() + { + Properties = new AzureDevOpsProjectProperties() + { + AutoDiscovery = AutoDiscovery.Disabled, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsProjectName, data); + AzureDevOpsProjectResource 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 + AzureDevOpsProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs new file mode 100644 index 000000000000..ac8922d628db --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsProjectResource.cs @@ -0,0 +1,95 @@ +// 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.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsProjectResource + { + // AzureDevOpsProject_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsProjectGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectGet.json + // this example is just showing the usage of "AzureDevOpsProject_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // invoke the operation + AzureDevOpsProjectResource result = await azureDevOpsProject.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 + AzureDevOpsProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsProject_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AzureDevOpsProjectUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsProjectUpdate.json + // this example is just showing the usage of "AzureDevOpsProject_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 AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // invoke the operation + AzureDevOpsProjectData data = new AzureDevOpsProjectData() + { + Properties = new AzureDevOpsProjectProperties() + { + AutoDiscovery = AutoDiscovery.Disabled, + }, + }; + ArmOperation lro = await azureDevOpsProject.UpdateAsync(WaitUntil.Completed, data); + AzureDevOpsProjectResource 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 + AzureDevOpsProjectData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs new file mode 100644 index 000000000000..04471e6e5b70 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoCollection.cs @@ -0,0 +1,192 @@ +// 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.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsRepoCollection + { + // AzureDevOpsRepo_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_AzureDevOpsRepoList() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoList.json + // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // get the collection of this AzureDevOpsRepoResource + AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); + + // invoke the operation and iterate over the result + await foreach (AzureDevOpsRepoResource 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 + AzureDevOpsRepoData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // AzureDevOpsRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json + // this example is just showing the usage of "AzureDevOpsRepo_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // get the collection of this AzureDevOpsRepoResource + AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); + + // invoke the operation + string azureDevOpsRepoName = "myRepo"; + AzureDevOpsRepoResource result = await collection.GetAsync(azureDevOpsRepoName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AzureDevOpsRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_AzureDevOpsRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json + // this example is just showing the usage of "AzureDevOpsRepo_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // get the collection of this AzureDevOpsRepoResource + AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); + + // invoke the operation + string azureDevOpsRepoName = "myRepo"; + bool result = await collection.ExistsAsync(azureDevOpsRepoName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // AzureDevOpsRepo_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_AzureDevOpsRepoCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoCreateOrUpdate.json + // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsProjectResource created on azure + // for more information of creating AzureDevOpsProjectResource, please refer to the document of AzureDevOpsProjectResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + ResourceIdentifier azureDevOpsProjectResourceId = AzureDevOpsProjectResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName); + AzureDevOpsProjectResource azureDevOpsProject = client.GetAzureDevOpsProjectResource(azureDevOpsProjectResourceId); + + // get the collection of this AzureDevOpsRepoResource + AzureDevOpsRepoCollection collection = azureDevOpsProject.GetAzureDevOpsRepos(); + + // invoke the operation + string azureDevOpsRepoName = "myRepo"; + AzureDevOpsRepoData data = new AzureDevOpsRepoData() + { + Properties = new AzureDevOpsRepoProperties() + { + RepoId = "00000000-0000-0000-0000-000000000000", + RepoUri = new Uri("https://dev.azure.com/myOrg/myProject/_git/myRepo"), + ActionableRemediation = new ActionableRemediation() + { + State = ActionableRemediationState.Enabled, + SeverityLevels = +{ +"High" +}, + Categories = +{ +ActionableRemediationRuleCategory.Secrets +}, + BranchNames = +{ +"main" +}, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureDevOpsRepoName, data); + AzureDevOpsRepoResource 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 + AzureDevOpsRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs new file mode 100644 index 000000000000..37da7ef97f28 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_AzureDevOpsRepoResource.cs @@ -0,0 +1,90 @@ +// 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.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_AzureDevOpsRepoResource + { + // AzureDevOpsRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_AzureDevOpsRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoGet.json + // this example is just showing the usage of "AzureDevOpsRepo_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AzureDevOpsRepoResource created on azure + // for more information of creating AzureDevOpsRepoResource, please refer to the document of AzureDevOpsRepoResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + string azureDevOpsRepoName = "myRepo"; + ResourceIdentifier azureDevOpsRepoResourceId = AzureDevOpsRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName, azureDevOpsRepoName); + AzureDevOpsRepoResource azureDevOpsRepo = client.GetAzureDevOpsRepoResource(azureDevOpsRepoResourceId); + + // invoke the operation + AzureDevOpsRepoResource result = await azureDevOpsRepo.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 + AzureDevOpsRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // AzureDevOpsRepo_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_AzureDevOpsRepoUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/AzureDevOpsRepoUpdate.json + // this example is just showing the usage of "AzureDevOpsRepo_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 AzureDevOpsRepoResource created on azure + // for more information of creating AzureDevOpsRepoResource, please refer to the document of AzureDevOpsRepoResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string azureDevOpsConnectorName = "testconnector"; + string azureDevOpsOrgName = "myOrg"; + string azureDevOpsProjectName = "myProject"; + string azureDevOpsRepoName = "myRepo"; + ResourceIdentifier azureDevOpsRepoResourceId = AzureDevOpsRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureDevOpsConnectorName, azureDevOpsOrgName, azureDevOpsProjectName, azureDevOpsRepoName); + AzureDevOpsRepoResource azureDevOpsRepo = client.GetAzureDevOpsRepoResource(azureDevOpsRepoResourceId); + + // invoke the operation + AzureDevOpsRepoData data = new AzureDevOpsRepoData(); + ArmOperation lro = await azureDevOpsRepo.UpdateAsync(WaitUntil.Completed, data); + AzureDevOpsRepoResource 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 + AzureDevOpsRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs new file mode 100644 index 000000000000..1bb50c0ac1e1 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorCollection.cs @@ -0,0 +1,164 @@ +// 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.Resources; +using Azure.ResourceManager.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_GitHubConnectorCollection + { + // GitHubConnector_ListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GitHubConnectorListByResourceGroup() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorListByResourceGroup.json + // this example is just showing the usage of "GitHubConnector_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 + 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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GitHubConnectorResource + GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); + + // invoke the operation and iterate over the result + await foreach (GitHubConnectorResource 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 + GitHubConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GitHubConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GitHubConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json + // this example is just showing the usage of "GitHubConnector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GitHubConnectorResource + GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); + + // invoke the operation + string gitHubConnectorName = "testconnector"; + GitHubConnectorResource result = await collection.GetAsync(gitHubConnectorName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GitHubConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GitHubConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json + // this example is just showing the usage of "GitHubConnector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GitHubConnectorResource + GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); + + // invoke the operation + string gitHubConnectorName = "testconnector"; + bool result = await collection.ExistsAsync(gitHubConnectorName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GitHubConnector_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GitHubConnectorCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorCreateOrUpdate.json + // this example is just showing the usage of "GitHubConnector_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 = "westusrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this GitHubConnectorResource + GitHubConnectorCollection collection = resourceGroupResource.GetGitHubConnectors(); + + // invoke the operation + string gitHubConnectorName = "testconnector"; + GitHubConnectorData data = new GitHubConnectorData(new AzureLocation("West US")) + { + Properties = new GitHubConnectorProperties() + { + Code = "00000000000000000000", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, gitHubConnectorName, data); + GitHubConnectorResource 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 + GitHubConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorResource.cs new file mode 100644 index 000000000000..bafff957f85b --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubConnectorResource.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.Resources; +using Azure.ResourceManager.SecurityDevOps; +using Azure.ResourceManager.SecurityDevOps.Models; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_GitHubConnectorResource + { + // GitHubConnector_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GitHubConnectorGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorGet.json + // this example is just showing the usage of "GitHubConnector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // invoke the operation + GitHubConnectorResource result = await gitHubConnector.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 + GitHubConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubConnector_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GitHubConnectorUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorUpdate.json + // this example is just showing the usage of "GitHubConnector_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 GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // invoke the operation + GitHubConnectorData data = new GitHubConnectorData(new AzureLocation("West US")) + { + Tags = +{ +["client"] = "dev-client", +["env"] = "dev", +}, + }; + ArmOperation lro = await gitHubConnector.UpdateAsync(WaitUntil.Completed, data); + GitHubConnectorResource 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 + GitHubConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubConnector_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_GitHubConnectorDelete() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorDelete.json + // this example is just showing the usage of "GitHubConnector_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 GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // invoke the operation + await gitHubConnector.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // GitHubConnector_ListBySubscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGitHubConnectors_GitHubConnectorListBySubscription() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorListBySubscription.json + // this example is just showing the usage of "GitHubConnector_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 + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // 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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (GitHubConnectorResource item in subscriptionResource.GetGitHubConnectorsAsync()) + { + // 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 + GitHubConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GitHubRepo_ListByConnector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGitHubReposByConnector_GitHubRepoListByConnector() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoListByConnector.json + // this example is just showing the usage of "GitHubRepo_ListByConnector" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // invoke the operation and iterate over the result + await foreach (GitHubRepoResource item in gitHubConnector.GetGitHubReposByConnectorAsync()) + { + // 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 + GitHubRepoData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GitHubConnectorStats_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGitHubConnectorStats_GitHubConnectorStatsGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubConnectorStatsGet.json + // this example is just showing the usage of "GitHubConnectorStats_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // invoke the operation and iterate over the result + await foreach (GitHubConnectorStats item in gitHubConnector.GetGitHubConnectorStatsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs new file mode 100644 index 000000000000..48ea3172edeb --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerCollection.cs @@ -0,0 +1,160 @@ +// 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.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_GitHubOwnerCollection + { + // GitHubOwner_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GitHubOwnerList() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerList.json + // this example is just showing the usage of "GitHubOwner_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 GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // get the collection of this GitHubOwnerResource + GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); + + // invoke the operation and iterate over the result + await foreach (GitHubOwnerResource 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 + GitHubOwnerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GitHubOwner_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GitHubOwnerGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json + // this example is just showing the usage of "GitHubOwner_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // get the collection of this GitHubOwnerResource + GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); + + // invoke the operation + string gitHubOwnerName = "Azure"; + GitHubOwnerResource result = await collection.GetAsync(gitHubOwnerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GitHubOwnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubOwner_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GitHubOwnerGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json + // this example is just showing the usage of "GitHubOwner_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // get the collection of this GitHubOwnerResource + GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); + + // invoke the operation + string gitHubOwnerName = "Azure"; + bool result = await collection.ExistsAsync(gitHubOwnerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GitHubOwner_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GitHubOwnerCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerCreateOrUpdate.json + // this example is just showing the usage of "GitHubOwner_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 GitHubConnectorResource created on azure + // for more information of creating GitHubConnectorResource, please refer to the document of GitHubConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + ResourceIdentifier gitHubConnectorResourceId = GitHubConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName); + GitHubConnectorResource gitHubConnector = client.GetGitHubConnectorResource(gitHubConnectorResourceId); + + // get the collection of this GitHubOwnerResource + GitHubOwnerCollection collection = gitHubConnector.GetGitHubOwners(); + + // invoke the operation + string gitHubOwnerName = "Azure"; + GitHubOwnerData data = new GitHubOwnerData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, gitHubOwnerName, data); + GitHubOwnerResource 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 + GitHubOwnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerResource.cs new file mode 100644 index 000000000000..55dea9a913fe --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubOwnerResource.cs @@ -0,0 +1,86 @@ +// 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.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_GitHubOwnerResource + { + // GitHubOwner_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GitHubOwnerGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerGet.json + // this example is just showing the usage of "GitHubOwner_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // invoke the operation + GitHubOwnerResource result = await gitHubOwner.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 + GitHubOwnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubOwner_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GitHubOwnerUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubOwnerUpdate.json + // this example is just showing the usage of "GitHubOwner_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 GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // invoke the operation + GitHubOwnerData data = new GitHubOwnerData(); + ArmOperation lro = await gitHubOwner.UpdateAsync(WaitUntil.Completed, data); + GitHubOwnerResource 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 + GitHubOwnerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs new file mode 100644 index 000000000000..ae10a7634bf8 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoCollection.cs @@ -0,0 +1,164 @@ +// 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.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_GitHubRepoCollection + { + // GitHubRepo_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GitHubRepoList() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoList.json + // this example is just showing the usage of "GitHubRepo_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 GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // get the collection of this GitHubRepoResource + GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); + + // invoke the operation and iterate over the result + await foreach (GitHubRepoResource 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 + GitHubRepoData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GitHubRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GitHubRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json + // this example is just showing the usage of "GitHubRepo_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // get the collection of this GitHubRepoResource + GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); + + // invoke the operation + string gitHubRepoName = "39093389"; + GitHubRepoResource result = await collection.GetAsync(gitHubRepoName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GitHubRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GitHubRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json + // this example is just showing the usage of "GitHubRepo_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // get the collection of this GitHubRepoResource + GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); + + // invoke the operation + string gitHubRepoName = "39093389"; + bool result = await collection.ExistsAsync(gitHubRepoName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GitHubRepo_CreateOrUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GitHubRepoCreateOrUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoCreateOrUpdate.json + // this example is just showing the usage of "GitHubRepo_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 GitHubOwnerResource created on azure + // for more information of creating GitHubOwnerResource, please refer to the document of GitHubOwnerResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + ResourceIdentifier gitHubOwnerResourceId = GitHubOwnerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName); + GitHubOwnerResource gitHubOwner = client.GetGitHubOwnerResource(gitHubOwnerResourceId); + + // get the collection of this GitHubRepoResource + GitHubRepoCollection collection = gitHubOwner.GetGitHubRepos(); + + // invoke the operation + string gitHubRepoName = "azure-rest-api-specs"; + GitHubRepoData data = new GitHubRepoData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, gitHubRepoName, data); + GitHubRepoResource 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 + GitHubRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoResource.cs new file mode 100644 index 000000000000..3b8acf137aad --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Generated/Samples/Sample_GitHubRepoResource.cs @@ -0,0 +1,88 @@ +// 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.SecurityDevOps; + +namespace Azure.ResourceManager.SecurityDevOps.Samples +{ + public partial class Sample_GitHubRepoResource + { + // GitHubRepo_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GitHubRepoGet() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoGet.json + // this example is just showing the usage of "GitHubRepo_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GitHubRepoResource created on azure + // for more information of creating GitHubRepoResource, please refer to the document of GitHubRepoResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + string gitHubRepoName = "39093389"; + ResourceIdentifier gitHubRepoResourceId = GitHubRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName, gitHubRepoName); + GitHubRepoResource gitHubRepo = client.GetGitHubRepoResource(gitHubRepoResourceId); + + // invoke the operation + GitHubRepoResource result = await gitHubRepo.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 + GitHubRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GitHubRepo_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GitHubRepoUpdate() + { + // Generated from example definition: specification/securitydevops/resource-manager/Microsoft.SecurityDevOps/preview/2022-09-01-preview/examples/GitHubRepoUpdate.json + // this example is just showing the usage of "GitHubRepo_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 GitHubRepoResource created on azure + // for more information of creating GitHubRepoResource, please refer to the document of GitHubRepoResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "westusrg"; + string gitHubConnectorName = "testconnector"; + string gitHubOwnerName = "Azure"; + string gitHubRepoName = "azure-rest-api-specs"; + ResourceIdentifier gitHubRepoResourceId = GitHubRepoResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, gitHubConnectorName, gitHubOwnerName, gitHubRepoName); + GitHubRepoResource gitHubRepo = client.GetGitHubRepoResource(gitHubRepoResourceId); + + // invoke the operation + GitHubRepoData data = new GitHubRepoData(); + ArmOperation lro = await gitHubRepo.UpdateAsync(WaitUntil.Completed, data); + GitHubRepoResource 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 + GitHubRepoData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} From 50707fecaa5fc9868909e876aabd1f52776cd359 Mon Sep 17 00:00:00 2001 From: ArcturusZhang Date: Tue, 12 Sep 2023 19:56:22 +0800 Subject: [PATCH 5/6] revert an unexpected removal --- ...Azure.ResourceManager.SecurityDevOps.Samples.csproj | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj new file mode 100644 index 000000000000..07959df64d38 --- /dev/null +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/samples/Azure.ResourceManager.SecurityDevOps.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + From 9b7e9e64ef34d6c9ae219b3083265600d6dba402 Mon Sep 17 00:00:00 2001 From: Arcturus Zhang Date: Wed, 13 Sep 2023 08:02:35 +0800 Subject: [PATCH 6/6] fix casing --- .../Azure.ResourceManager.SecurityDevOps.sln | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Azure.ResourceManager.SecurityDevOps.sln b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Azure.ResourceManager.SecurityDevOps.sln index 1485ae167440..e872cc2fca14 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Azure.ResourceManager.SecurityDevOps.sln +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/Azure.ResourceManager.SecurityDevOps.sln @@ -7,7 +7,7 @@ Project("{E298A5B7-DDEE-4DDB-ADB5-86437D7668A3}") = "Azure.ResourceManager.Secur EndProject Project("{E298A5B7-DDEE-4DDB-ADB5-86437D7668A3}") = "Azure.ResourceManager.SecurityDevOps.Tests", "tests\Azure.ResourceManager.SecurityDevOps.Tests.csproj", "{29307F4D-07DD-433A-BE5A-401689A3B737}" EndProject -Project("{E298A5B7-DDEE-4DDB-ADB5-86437D7668A3}") = "Azure.ResourceManager.SecurityDevOps.Samples", "Samples\Azure.ResourceManager.SecurityDevOps.Samples.csproj", "{F340C8EB-943B-41CF-B9B3-CB5E5BF339BF}" +Project("{E298A5B7-DDEE-4DDB-ADB5-86437D7668A3}") = "Azure.ResourceManager.SecurityDevOps.Samples", "samples\Azure.ResourceManager.SecurityDevOps.Samples.csproj", "{F340C8EB-943B-41CF-B9B3-CB5E5BF339BF}" EndProject Global GlobalSection(SolutionProperties) = preSolution