From 16541c52ae9559c8f12fcb5fe91743c59309deed Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 15 Dec 2021 09:15:20 +0000 Subject: [PATCH] CodeGen from PR 17103 in Azure/azure-rest-api-specs Merge aaaee72c35ee915a88bedc71edd914f6fbe6507d into ac1a40083935e2446180460410fcb17d5f1baf3d --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../azure-resourcemanager-devops/CHANGELOG.md | 5 + .../azure-resourcemanager-devops/README.md | 102 ++ .../azure-resourcemanager-devops/SAMPLE.md | 257 +++ .../azure-resourcemanager-devops/pom.xml | 81 + .../resourcemanager/devops/DevopsManager.java | 267 ++++ .../devops/fluent/AzureDevOps.java | 68 + .../devops/fluent/OperationsClient.java | 36 + .../PipelineTemplateDefinitionsClient.java | 36 + .../devops/fluent/PipelinesClient.java | 221 +++ .../fluent/models/OperationDisplayValue.java | 84 + .../devops/fluent/models/OperationInner.java | 119 ++ .../devops/fluent/models/PipelineInner.java | 146 ++ .../fluent/models/PipelineProperties.java | 142 ++ .../PipelineTemplateDefinitionInner.java | 113 ++ .../devops/fluent/models/package-info.java | 6 + .../devops/fluent/package-info.java | 6 + .../implementation/AzureDevOpsBuilder.java | 148 ++ .../implementation/AzureDevOpsImpl.java | 326 ++++ .../devops/implementation/OperationImpl.java | 51 + .../implementation/OperationsClientImpl.java | 269 ++++ .../devops/implementation/OperationsImpl.java | 45 + .../devops/implementation/PipelineImpl.java | 205 +++ .../PipelineTemplateDefinitionImpl.java | 48 + ...PipelineTemplateDefinitionsClientImpl.java | 272 ++++ .../PipelineTemplateDefinitionsImpl.java | 46 + .../implementation/PipelinesClientImpl.java | 1382 +++++++++++++++++ .../devops/implementation/PipelinesImpl.java | 169 ++ .../devops/implementation/Utils.java | 204 +++ .../devops/implementation/package-info.java | 6 + .../devops/models/Authorization.java | 84 + .../devops/models/AuthorizationType.java | 31 + .../devops/models/BootstrapConfiguration.java | 86 + .../devops/models/CodeRepository.java | 176 +++ .../devops/models/CodeRepositoryType.java | 34 + .../devops/models/InputDataType.java | 43 + .../devops/models/InputDescriptor.java | 142 ++ .../devops/models/InputValue.java | 76 + .../devops/models/Operation.java | 59 + .../devops/models/OperationListResult.java | 70 + .../devops/models/Operations.java | 31 + .../devops/models/OrganizationReference.java | 70 + .../devops/models/Pipeline.java | 255 +++ .../devops/models/PipelineListResult.java | 81 + .../devops/models/PipelineTemplate.java | 84 + .../models/PipelineTemplateDefinition.java | 39 + .../PipelineTemplateDefinitionListResult.java | 82 + .../models/PipelineTemplateDefinitions.java | 31 + .../models/PipelineUpdateParameters.java | 56 + .../devops/models/Pipelines.java | 157 ++ .../devops/models/ProjectReference.java | 70 + .../devops/models/package-info.java | 6 + .../resourcemanager/devops/package-info.java | 6 + .../src/main/java/module-info.java | 19 + .../generated/OperationsListSamples.java | 23 + ...ipelineTemplateDefinitionsListSamples.java | 22 + .../PipelinesCreateOrUpdateSamples.java | 68 + .../generated/PipelinesDeleteSamples.java | 22 + .../PipelinesGetByResourceGroupSamples.java | 24 + .../PipelinesListByResourceGroupSamples.java | 23 + .../generated/PipelinesListSamples.java | 23 + .../generated/PipelinesUpdateSamples.java | 41 + sdk/devops/ci.yml | 39 + sdk/devops/pom.xml | 53 + 65 files changed, 6988 insertions(+) create mode 100644 sdk/devops/azure-resourcemanager-devops/CHANGELOG.md create mode 100644 sdk/devops/azure-resourcemanager-devops/README.md create mode 100644 sdk/devops/azure-resourcemanager-devops/SAMPLE.md create mode 100644 sdk/devops/azure-resourcemanager-devops/pom.xml create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/DevopsManager.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/AzureDevOps.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/OperationsClient.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelineTemplateDefinitionsClient.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelinesClient.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationDisplayValue.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationInner.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineInner.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineProperties.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineTemplateDefinitionInner.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/package-info.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/package-info.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsBuilder.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsClientImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsClientImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesClientImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesImpl.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/Utils.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/package-info.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Authorization.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/AuthorizationType.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/BootstrapConfiguration.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepository.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepositoryType.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDataType.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDescriptor.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputValue.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operation.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OperationListResult.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operations.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OrganizationReference.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipeline.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineListResult.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplate.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinition.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitionListResult.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitions.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineUpdateParameters.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipelines.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/ProjectReference.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/package-info.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/package-info.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/main/java/module-info.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/OperationsListSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelineTemplateDefinitionsListSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesCreateOrUpdateSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesDeleteSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesGetByResourceGroupSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListByResourceGroupSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListSamples.java create mode 100644 sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesUpdateSamples.java create mode 100644 sdk/devops/ci.yml create mode 100644 sdk/devops/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 3acc4771ced77..dd1769a67dbc9 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -326,6 +326,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagepool;1.0.0-beta.1;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-dataprotection;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-devops;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index 928014fa07f54..23f575cc3d42e 100644 --- a/pom.xml +++ b/pom.xml @@ -757,6 +757,7 @@ sdk/desktopvirtualization sdk/deviceprovisioningservices sdk/deviceupdate + sdk/devops sdk/devspaces sdk/devtestlabs sdk/digitaltwins diff --git a/sdk/devops/azure-resourcemanager-devops/CHANGELOG.md b/sdk/devops/azure-resourcemanager-devops/CHANGELOG.md new file mode 100644 index 0000000000000..42f81edb8cbf8 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-12-15) + +- Azure Resource Manager devops client library for Java. This package contains Microsoft Azure SDK for devops Management SDK. Azure DevOps Resource Provider. Package tag package-2019-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/devops/azure-resourcemanager-devops/README.md b/sdk/devops/azure-resourcemanager-devops/README.md new file mode 100644 index 0000000000000..3ef940db8be87 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager devops client library for Java + +Azure Resource Manager devops client library for Java. + +This package contains Microsoft Azure SDK for devops Management SDK. Azure DevOps Resource Provider. Package tag package-2019-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-devops;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-devops + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DevopsManager manager = DevopsManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/devops/azure-resourcemanager-devops/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/devops/azure-resourcemanager-devops/SAMPLE.md b/sdk/devops/azure-resourcemanager-devops/SAMPLE.md new file mode 100644 index 0000000000000..eeb627067c364 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/SAMPLE.md @@ -0,0 +1,257 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## PipelineTemplateDefinitions + +- [List](#pipelinetemplatedefinitions_list) + +## Pipelines + +- [CreateOrUpdate](#pipelines_createorupdate) +- [Delete](#pipelines_delete) +- [GetByResourceGroup](#pipelines_getbyresourcegroup) +- [List](#pipelines_list) +- [ListByResourceGroup](#pipelines_listbyresourcegroup) +- [Update](#pipelines_update) +### Operations_List + +```java +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListOperations.json + */ + /** + * Sample code: Get a list of operations supported by Microsoft.DevOps resource provider. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAListOfOperationsSupportedByMicrosoftDevOpsResourceProvider( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### PipelineTemplateDefinitions_List + +```java +import com.azure.core.util.Context; + +/** Samples for PipelineTemplateDefinitions List. */ +public final class PipelineTemplateDefinitionsListSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListPipelineTemplateDefinitions.json + */ + /** + * Sample code: Get the list of pipeline template definitions. + * + * @param manager Entry point to DevopsManager. + */ + public static void getTheListOfPipelineTemplateDefinitions(com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelineTemplateDefinitions().list(Context.NONE); + } +} +``` + +### Pipelines_CreateOrUpdate + +```java +import com.azure.resourcemanager.devops.models.BootstrapConfiguration; +import com.azure.resourcemanager.devops.models.OrganizationReference; +import com.azure.resourcemanager.devops.models.PipelineTemplate; +import com.azure.resourcemanager.devops.models.ProjectReference; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Pipelines CreateOrUpdate. */ +public final class PipelinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/CreateAzurePipeline-Sample-AspNet-WindowsWebApp.json + */ + /** + * Sample code: Create an Azure pipeline to deploy a sample ASP.Net application to Azure web-app. + * + * @param manager Entry point to DevopsManager. + */ + public static void createAnAzurePipelineToDeployASampleASPNetApplicationToAzureWebApp( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager + .pipelines() + .define("myAspNetWebAppPipeline") + .withRegion("South India") + .withExistingResourceGroup("myAspNetWebAppPipeline-rg") + .withOrganization(new OrganizationReference().withName("myAspNetWebAppPipeline-org")) + .withProject(new ProjectReference().withName("myAspNetWebAppPipeline-project")) + .withBootstrapConfiguration( + new BootstrapConfiguration() + .withTemplate( + new PipelineTemplate() + .withId("ms.vss-continuous-delivery-pipeline-templates.aspnet-windowswebapp") + .withParameters( + mapOf( + "appInsightLocation", + "South India", + "appServicePlan", + "S1 Standard", + "azureAuth", + "{\"scheme\":\"ServicePrincipal\",\"parameters\":{\"tenantid\":\"{subscriptionTenantId}\",\"objectid\":\"{appObjectId}\",\"serviceprincipalid\":\"{appId}\",\"serviceprincipalkey\":\"{appSecret}\"}}", + "location", + "South India", + "resourceGroup", + "myAspNetWebAppPipeline-rg", + "subscriptionId", + "{subscriptionId}", + "webAppName", + "myAspNetWebApp")))) + .withTags(mapOf()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Pipelines_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for Pipelines Delete. */ +public final class PipelinesDeleteSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/DeleteAzurePipeline.json + */ + /** + * Sample code: Get an existing Azure pipeline. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelines().deleteWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE); + } +} +``` + +### Pipelines_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Pipelines GetByResourceGroup. */ +public final class PipelinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/GetAzurePipeline.json + */ + /** + * Sample code: Get an existing Azure pipeline. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) { + manager + .pipelines() + .getByResourceGroupWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE); + } +} +``` + +### Pipelines_List + +```java +import com.azure.core.util.Context; + +/** Samples for Pipelines List. */ +public final class PipelinesListSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListAzurePipelinesBySubscription.json + */ + /** + * Sample code: List all Azure pipelines under the specified subscription. + * + * @param manager Entry point to DevopsManager. + */ + public static void listAllAzurePipelinesUnderTheSpecifiedSubscription( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelines().list(Context.NONE); + } +} +``` + +### Pipelines_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for Pipelines ListByResourceGroup. */ +public final class PipelinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListAzurePipelinesByResourceGroup.json + */ + /** + * Sample code: List all Azure Pipelines under the specified resource group. + * + * @param manager Entry point to DevopsManager. + */ + public static void listAllAzurePipelinesUnderTheSpecifiedResourceGroup( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelines().listByResourceGroup("myAspNetWebAppPipeline-rg", Context.NONE); + } +} +``` + +### Pipelines_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.devops.models.Pipeline; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Pipelines Update. */ +public final class PipelinesUpdateSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/UpdateAzurePipeline.json + */ + /** + * Sample code: Get an existing Azure pipeline. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) { + Pipeline resource = + manager + .pipelines() + .getByResourceGroupWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey", "tagvalue")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/devops/azure-resourcemanager-devops/pom.xml b/sdk/devops/azure-resourcemanager-devops/pom.xml new file mode 100644 index 0000000000000..eb5ceae437d38 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-devops + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for devops Management + This package contains Microsoft Azure SDK for devops Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure DevOps Resource Provider. Package tag package-2019-07-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/DevopsManager.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/DevopsManager.java new file mode 100644 index 0000000000000..9a60d6bc3515a --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/DevopsManager.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.AzureDevOps; +import com.azure.resourcemanager.devops.implementation.AzureDevOpsBuilder; +import com.azure.resourcemanager.devops.implementation.OperationsImpl; +import com.azure.resourcemanager.devops.implementation.PipelineTemplateDefinitionsImpl; +import com.azure.resourcemanager.devops.implementation.PipelinesImpl; +import com.azure.resourcemanager.devops.models.Operations; +import com.azure.resourcemanager.devops.models.PipelineTemplateDefinitions; +import com.azure.resourcemanager.devops.models.Pipelines; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to DevopsManager. Azure DevOps Resource Provider. */ +public final class DevopsManager { + private Operations operations; + + private PipelineTemplateDefinitions pipelineTemplateDefinitions; + + private Pipelines pipelines; + + private final AzureDevOps clientObject; + + private DevopsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AzureDevOpsBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of devops service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the devops service API instance. + */ + public static DevopsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create DevopsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DevopsManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of devops service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the devops service API instance. + */ + public DevopsManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.devops") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DevopsManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of PipelineTemplateDefinitions. */ + public PipelineTemplateDefinitions pipelineTemplateDefinitions() { + if (this.pipelineTemplateDefinitions == null) { + this.pipelineTemplateDefinitions = + new PipelineTemplateDefinitionsImpl(clientObject.getPipelineTemplateDefinitions(), this); + } + return pipelineTemplateDefinitions; + } + + /** @return Resource collection API of Pipelines. */ + public Pipelines pipelines() { + if (this.pipelines == null) { + this.pipelines = new PipelinesImpl(clientObject.getPipelines(), this); + } + return pipelines; + } + + /** + * @return Wrapped service client AzureDevOps providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public AzureDevOps serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/AzureDevOps.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/AzureDevOps.java new file mode 100644 index 0000000000000..2a656cacf9f07 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/AzureDevOps.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AzureDevOps class. */ +public interface AzureDevOps { + /** + * Gets Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the PipelineTemplateDefinitionsClient object to access its operations. + * + * @return the PipelineTemplateDefinitionsClient object. + */ + PipelineTemplateDefinitionsClient getPipelineTemplateDefinitions(); + + /** + * Gets the PipelinesClient object to access its operations. + * + * @return the PipelinesClient object. + */ + PipelinesClient getPipelines(); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/OperationsClient.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/OperationsClient.java new file mode 100644 index 0000000000000..c12681cf4218d --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devops.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelineTemplateDefinitionsClient.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelineTemplateDefinitionsClient.java new file mode 100644 index 0000000000000..6800132094338 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelineTemplateDefinitionsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner; + +/** An instance of this class provides access to all the operations defined in PipelineTemplateDefinitionsClient. */ +public interface PipelineTemplateDefinitionsClient { + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelinesClient.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelinesClient.java new file mode 100644 index 0000000000000..cc04786393378 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/PipelinesClient.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devops.fluent.models.PipelineInner; +import com.azure.resourcemanager.devops.models.PipelineUpdateParameters; + +/** An instance of this class provides access to all the operations defined in PipelinesClient. */ +public interface PipelinesClient { + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PipelineInner> beginCreateOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters); + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PipelineInner> beginCreateOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context); + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PipelineInner createOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters); + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PipelineInner createOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context); + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PipelineInner getByResourceGroup(String resourceGroupName, String pipelineName); + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String pipelineName, Context context); + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PipelineInner update( + String resourceGroupName, String pipelineName, PipelineUpdateParameters updateOperationParameters); + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String pipelineName, + PipelineUpdateParameters updateOperationParameters, + Context context); + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String pipelineName); + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String pipelineName, Context context); + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationDisplayValue.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationDisplayValue.java new file mode 100644 index 0000000000000..805107d642dc4 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationDisplayValue.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display information of an operation. */ +@Immutable +public final class OperationDisplayValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplayValue.class); + + /* + * Friendly name of the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Friendly name of the resource type the operation applies to. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Friendly description of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /** + * Get the operation property: Friendly name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource property: Friendly name of the resource type the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the description property: Friendly description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the provider property: Friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationInner.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..0666035566e04 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/OperationInner.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Name of the operation. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Indicates whether the operation applies to data-plane. + */ + @JsonProperty(value = "isDataAction") + private String isDataAction; + + /* + * Display information of the operation. + */ + @JsonProperty(value = "display") + private OperationDisplayValue innerDisplay; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @return the isDataAction value. + */ + public String isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationInner object itself. + */ + public OperationInner withIsDataAction(String isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Get the innerDisplay property: Display information of the operation. + * + * @return the innerDisplay value. + */ + private OperationDisplayValue innerDisplay() { + return this.innerDisplay; + } + + /** + * Get the operation property: Friendly name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.innerDisplay() == null ? null : this.innerDisplay().operation(); + } + + /** + * Get the resource property: Friendly name of the resource type the operation applies to. + * + * @return the resource value. + */ + public String resource() { + return this.innerDisplay() == null ? null : this.innerDisplay().resource(); + } + + /** + * Get the description property: Friendly description of the operation. + * + * @return the description value. + */ + public String description() { + return this.innerDisplay() == null ? null : this.innerDisplay().description(); + } + + /** + * Get the provider property: Friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.innerDisplay() == null ? null : this.innerDisplay().provider(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerDisplay() != null) { + innerDisplay().validate(); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineInner.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineInner.java new file mode 100644 index 0000000000000..7c10b3c8c6a8e --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.models.BootstrapConfiguration; +import com.azure.resourcemanager.devops.models.OrganizationReference; +import com.azure.resourcemanager.devops.models.ProjectReference; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * Azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for Azure + * resources. + */ +@Fluent +public final class PipelineInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineInner.class); + + /* + * Custom properties of the Pipeline. + */ + @JsonProperty(value = "properties", required = true) + private PipelineProperties innerProperties = new PipelineProperties(); + + /** + * Get the innerProperties property: Custom properties of the Pipeline. + * + * @return the innerProperties value. + */ + private PipelineProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public PipelineInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public PipelineInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the pipelineId property: Unique identifier of the Azure Pipeline within the Azure DevOps Project. + * + * @return the pipelineId value. + */ + public Integer pipelineId() { + return this.innerProperties() == null ? null : this.innerProperties().pipelineId(); + } + + /** + * Get the organization property: Reference to the Azure DevOps Organization containing the Pipeline. + * + * @return the organization value. + */ + public OrganizationReference organization() { + return this.innerProperties() == null ? null : this.innerProperties().organization(); + } + + /** + * Set the organization property: Reference to the Azure DevOps Organization containing the Pipeline. + * + * @param organization the organization value to set. + * @return the PipelineInner object itself. + */ + public PipelineInner withOrganization(OrganizationReference organization) { + if (this.innerProperties() == null) { + this.innerProperties = new PipelineProperties(); + } + this.innerProperties().withOrganization(organization); + return this; + } + + /** + * Get the project property: Reference to the Azure DevOps Project containing the Pipeline. + * + * @return the project value. + */ + public ProjectReference project() { + return this.innerProperties() == null ? null : this.innerProperties().project(); + } + + /** + * Set the project property: Reference to the Azure DevOps Project containing the Pipeline. + * + * @param project the project value to set. + * @return the PipelineInner object itself. + */ + public PipelineInner withProject(ProjectReference project) { + if (this.innerProperties() == null) { + this.innerProperties = new PipelineProperties(); + } + this.innerProperties().withProject(project); + return this; + } + + /** + * Get the bootstrapConfiguration property: Configuration used to bootstrap the Pipeline. + * + * @return the bootstrapConfiguration value. + */ + public BootstrapConfiguration bootstrapConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().bootstrapConfiguration(); + } + + /** + * Set the bootstrapConfiguration property: Configuration used to bootstrap the Pipeline. + * + * @param bootstrapConfiguration the bootstrapConfiguration value to set. + * @return the PipelineInner object itself. + */ + public PipelineInner withBootstrapConfiguration(BootstrapConfiguration bootstrapConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new PipelineProperties(); + } + this.innerProperties().withBootstrapConfiguration(bootstrapConfiguration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model PipelineInner")); + } else { + innerProperties().validate(); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineProperties.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineProperties.java new file mode 100644 index 0000000000000..539499f13d43b --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.models.BootstrapConfiguration; +import com.azure.resourcemanager.devops.models.OrganizationReference; +import com.azure.resourcemanager.devops.models.ProjectReference; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Custom properties of a Pipeline. */ +@Fluent +public final class PipelineProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineProperties.class); + + /* + * Unique identifier of the Azure Pipeline within the Azure DevOps Project. + */ + @JsonProperty(value = "pipelineId", access = JsonProperty.Access.WRITE_ONLY) + private Integer pipelineId; + + /* + * Reference to the Azure DevOps Organization containing the Pipeline. + */ + @JsonProperty(value = "organization", required = true) + private OrganizationReference organization; + + /* + * Reference to the Azure DevOps Project containing the Pipeline. + */ + @JsonProperty(value = "project", required = true) + private ProjectReference project; + + /* + * Configuration used to bootstrap the Pipeline. + */ + @JsonProperty(value = "bootstrapConfiguration", required = true) + private BootstrapConfiguration bootstrapConfiguration; + + /** + * Get the pipelineId property: Unique identifier of the Azure Pipeline within the Azure DevOps Project. + * + * @return the pipelineId value. + */ + public Integer pipelineId() { + return this.pipelineId; + } + + /** + * Get the organization property: Reference to the Azure DevOps Organization containing the Pipeline. + * + * @return the organization value. + */ + public OrganizationReference organization() { + return this.organization; + } + + /** + * Set the organization property: Reference to the Azure DevOps Organization containing the Pipeline. + * + * @param organization the organization value to set. + * @return the PipelineProperties object itself. + */ + public PipelineProperties withOrganization(OrganizationReference organization) { + this.organization = organization; + return this; + } + + /** + * Get the project property: Reference to the Azure DevOps Project containing the Pipeline. + * + * @return the project value. + */ + public ProjectReference project() { + return this.project; + } + + /** + * Set the project property: Reference to the Azure DevOps Project containing the Pipeline. + * + * @param project the project value to set. + * @return the PipelineProperties object itself. + */ + public PipelineProperties withProject(ProjectReference project) { + this.project = project; + return this; + } + + /** + * Get the bootstrapConfiguration property: Configuration used to bootstrap the Pipeline. + * + * @return the bootstrapConfiguration value. + */ + public BootstrapConfiguration bootstrapConfiguration() { + return this.bootstrapConfiguration; + } + + /** + * Set the bootstrapConfiguration property: Configuration used to bootstrap the Pipeline. + * + * @param bootstrapConfiguration the bootstrapConfiguration value to set. + * @return the PipelineProperties object itself. + */ + public PipelineProperties withBootstrapConfiguration(BootstrapConfiguration bootstrapConfiguration) { + this.bootstrapConfiguration = bootstrapConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (organization() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property organization in model PipelineProperties")); + } else { + organization().validate(); + } + if (project() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property project in model PipelineProperties")); + } else { + project().validate(); + } + if (bootstrapConfiguration() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property bootstrapConfiguration in model PipelineProperties")); + } else { + bootstrapConfiguration().validate(); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineTemplateDefinitionInner.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineTemplateDefinitionInner.java new file mode 100644 index 0000000000000..26c4902c2a5d4 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/PipelineTemplateDefinitionInner.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.models.InputDescriptor; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Definition of a pipeline template. */ +@Fluent +public final class PipelineTemplateDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineTemplateDefinitionInner.class); + + /* + * Unique identifier of the pipeline template. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Description of the pipeline enabled by the template. + */ + @JsonProperty(value = "description") + private String description; + + /* + * List of input parameters required by the template to create a pipeline. + */ + @JsonProperty(value = "inputs") + private List inputs; + + /** + * Get the id property: Unique identifier of the pipeline template. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Unique identifier of the pipeline template. + * + * @param id the id value to set. + * @return the PipelineTemplateDefinitionInner object itself. + */ + public PipelineTemplateDefinitionInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the description property: Description of the pipeline enabled by the template. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the pipeline enabled by the template. + * + * @param description the description value to set. + * @return the PipelineTemplateDefinitionInner object itself. + */ + public PipelineTemplateDefinitionInner withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the inputs property: List of input parameters required by the template to create a pipeline. + * + * @return the inputs value. + */ + public List inputs() { + return this.inputs; + } + + /** + * Set the inputs property: List of input parameters required by the template to create a pipeline. + * + * @param inputs the inputs value to set. + * @return the PipelineTemplateDefinitionInner object itself. + */ + public PipelineTemplateDefinitionInner withInputs(List inputs) { + this.inputs = inputs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property id in model PipelineTemplateDefinitionInner")); + } + if (inputs() != null) { + inputs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/package-info.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/package-info.java new file mode 100644 index 0000000000000..ca777be1b9119 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for AzureDevOps. Azure DevOps Resource Provider. */ +package com.azure.resourcemanager.devops.fluent.models; diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/package-info.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/package-info.java new file mode 100644 index 0000000000000..07892f1a2ab45 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for AzureDevOps. Azure DevOps Resource Provider. */ +package com.azure.resourcemanager.devops.fluent; diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsBuilder.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsBuilder.java new file mode 100644 index 0000000000000..5914a0c028f13 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsBuilder.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the AzureDevOpsImpl type. */ +@ServiceClientBuilder(serviceClients = {AzureDevOpsImpl.class}) +public final class AzureDevOpsBuilder { + /* + * Unique identifier of the Azure subscription. This is a GUID-formatted + * string (e.g. 00000000-0000-0000-0000-000000000000). + */ + private String subscriptionId; + + /** + * Sets Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @param subscriptionId the subscriptionId value. + * @return the AzureDevOpsBuilder. + */ + public AzureDevOpsBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AzureDevOpsBuilder. + */ + public AzureDevOpsBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the AzureDevOpsBuilder. + */ + public AzureDevOpsBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the AzureDevOpsBuilder. + */ + public AzureDevOpsBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the AzureDevOpsBuilder. + */ + public AzureDevOpsBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the AzureDevOpsBuilder. + */ + public AzureDevOpsBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AzureDevOpsImpl with the provided parameters. + * + * @return an instance of AzureDevOpsImpl. + */ + public AzureDevOpsImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + AzureDevOpsImpl client = + new AzureDevOpsImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsImpl.java new file mode 100644 index 0000000000000..071d3e7a6a434 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/AzureDevOpsImpl.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.devops.fluent.AzureDevOps; +import com.azure.resourcemanager.devops.fluent.OperationsClient; +import com.azure.resourcemanager.devops.fluent.PipelineTemplateDefinitionsClient; +import com.azure.resourcemanager.devops.fluent.PipelinesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the AzureDevOpsImpl type. */ +@ServiceClient(builder = AzureDevOpsBuilder.class) +public final class AzureDevOpsImpl implements AzureDevOps { + private final ClientLogger logger = new ClientLogger(AzureDevOpsImpl.class); + + /** + * Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + */ + private final String subscriptionId; + + /** + * Gets Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The PipelineTemplateDefinitionsClient object to access its operations. */ + private final PipelineTemplateDefinitionsClient pipelineTemplateDefinitions; + + /** + * Gets the PipelineTemplateDefinitionsClient object to access its operations. + * + * @return the PipelineTemplateDefinitionsClient object. + */ + public PipelineTemplateDefinitionsClient getPipelineTemplateDefinitions() { + return this.pipelineTemplateDefinitions; + } + + /** The PipelinesClient object to access its operations. */ + private final PipelinesClient pipelines; + + /** + * Gets the PipelinesClient object to access its operations. + * + * @return the PipelinesClient object. + */ + public PipelinesClient getPipelines() { + return this.pipelines; + } + + /** + * Initializes an instance of AzureDevOps client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Unique identifier of the Azure subscription. This is a GUID-formatted string (e.g. + * 00000000-0000-0000-0000-000000000000). + * @param endpoint server parameter. + */ + AzureDevOpsImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2019-07-01-preview"; + this.operations = new OperationsClientImpl(this); + this.pipelineTemplateDefinitions = new PipelineTemplateDefinitionsClientImpl(this); + this.pipelines = new PipelinesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationImpl.java new file mode 100644 index 0000000000000..ad40320b884b0 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.resourcemanager.devops.fluent.models.OperationInner; +import com.azure.resourcemanager.devops.models.Operation; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.devops.DevopsManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String isDataAction() { + return this.innerModel().isDataAction(); + } + + public String operation() { + return this.innerModel().operation(); + } + + public String resource() { + return this.innerModel().resource(); + } + + public String description() { + return this.innerModel().description(); + } + + public String provider() { + return this.innerModel().provider(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devops.DevopsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsClientImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..80e0be9e74edf --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.OperationsClient; +import com.azure.resourcemanager.devops.fluent.models.OperationInner; +import com.azure.resourcemanager.devops.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final AzureDevOpsImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AzureDevOpsImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDevOpsOperations to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDevOpsOperation") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DevOps/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..2f7ff73bc9bd5 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.OperationsClient; +import com.azure.resourcemanager.devops.fluent.models.OperationInner; +import com.azure.resourcemanager.devops.models.Operation; +import com.azure.resourcemanager.devops.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.devops.DevopsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devops.DevopsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineImpl.java new file mode 100644 index 0000000000000..f628cd10e3ad2 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineImpl.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devops.fluent.models.PipelineInner; +import com.azure.resourcemanager.devops.models.BootstrapConfiguration; +import com.azure.resourcemanager.devops.models.OrganizationReference; +import com.azure.resourcemanager.devops.models.Pipeline; +import com.azure.resourcemanager.devops.models.PipelineUpdateParameters; +import com.azure.resourcemanager.devops.models.ProjectReference; +import java.util.Collections; +import java.util.Map; + +public final class PipelineImpl implements Pipeline, Pipeline.Definition, Pipeline.Update { + private PipelineInner innerObject; + + private final com.azure.resourcemanager.devops.DevopsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Integer pipelineId() { + return this.innerModel().pipelineId(); + } + + public OrganizationReference organization() { + return this.innerModel().organization(); + } + + public ProjectReference project() { + return this.innerModel().project(); + } + + public BootstrapConfiguration bootstrapConfiguration() { + return this.innerModel().bootstrapConfiguration(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public PipelineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devops.DevopsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String pipelineName; + + private PipelineUpdateParameters updateUpdateOperationParameters; + + public PipelineImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Pipeline create() { + this.innerObject = + serviceManager + .serviceClient() + .getPipelines() + .createOrUpdate(resourceGroupName, pipelineName, this.innerModel(), Context.NONE); + return this; + } + + public Pipeline create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPipelines() + .createOrUpdate(resourceGroupName, pipelineName, this.innerModel(), context); + return this; + } + + PipelineImpl(String name, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerObject = new PipelineInner(); + this.serviceManager = serviceManager; + this.pipelineName = name; + } + + public PipelineImpl update() { + this.updateUpdateOperationParameters = new PipelineUpdateParameters(); + return this; + } + + public Pipeline apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPipelines() + .updateWithResponse(resourceGroupName, pipelineName, updateUpdateOperationParameters, Context.NONE) + .getValue(); + return this; + } + + public Pipeline apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPipelines() + .updateWithResponse(resourceGroupName, pipelineName, updateUpdateOperationParameters, context) + .getValue(); + return this; + } + + PipelineImpl(PipelineInner innerObject, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.pipelineName = Utils.getValueFromIdByName(innerObject.id(), "pipelines"); + } + + public Pipeline refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPipelines() + .getByResourceGroupWithResponse(resourceGroupName, pipelineName, Context.NONE) + .getValue(); + return this; + } + + public Pipeline refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPipelines() + .getByResourceGroupWithResponse(resourceGroupName, pipelineName, context) + .getValue(); + return this; + } + + public PipelineImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PipelineImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PipelineImpl withOrganization(OrganizationReference organization) { + this.innerModel().withOrganization(organization); + return this; + } + + public PipelineImpl withProject(ProjectReference project) { + this.innerModel().withProject(project); + return this; + } + + public PipelineImpl withBootstrapConfiguration(BootstrapConfiguration bootstrapConfiguration) { + this.innerModel().withBootstrapConfiguration(bootstrapConfiguration); + return this; + } + + public PipelineImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateUpdateOperationParameters.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionImpl.java new file mode 100644 index 0000000000000..8a0007e8f00c1 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner; +import com.azure.resourcemanager.devops.models.InputDescriptor; +import com.azure.resourcemanager.devops.models.PipelineTemplateDefinition; +import java.util.Collections; +import java.util.List; + +public final class PipelineTemplateDefinitionImpl implements PipelineTemplateDefinition { + private PipelineTemplateDefinitionInner innerObject; + + private final com.azure.resourcemanager.devops.DevopsManager serviceManager; + + PipelineTemplateDefinitionImpl( + PipelineTemplateDefinitionInner innerObject, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String description() { + return this.innerModel().description(); + } + + public List inputs() { + List inner = this.innerModel().inputs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PipelineTemplateDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.devops.DevopsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsClientImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsClientImpl.java new file mode 100644 index 0000000000000..898092da0fe9c --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsClientImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.PipelineTemplateDefinitionsClient; +import com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner; +import com.azure.resourcemanager.devops.models.PipelineTemplateDefinitionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PipelineTemplateDefinitionsClient. */ +public final class PipelineTemplateDefinitionsClientImpl implements PipelineTemplateDefinitionsClient { + private final ClientLogger logger = new ClientLogger(PipelineTemplateDefinitionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PipelineTemplateDefinitionsService service; + + /** The service client containing this operation class. */ + private final AzureDevOpsImpl client; + + /** + * Initializes an instance of PipelineTemplateDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PipelineTemplateDefinitionsClientImpl(AzureDevOpsImpl client) { + this.service = + RestProxy + .create( + PipelineTemplateDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDevOpsPipelineTemplateDefinitions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDevOpsPipelineT") + private interface PipelineTemplateDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DevOps/pipelineTemplateDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsImpl.java new file mode 100644 index 0000000000000..2f327781aa256 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelineTemplateDefinitionsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.PipelineTemplateDefinitionsClient; +import com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner; +import com.azure.resourcemanager.devops.models.PipelineTemplateDefinition; +import com.azure.resourcemanager.devops.models.PipelineTemplateDefinitions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PipelineTemplateDefinitionsImpl implements PipelineTemplateDefinitions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineTemplateDefinitionsImpl.class); + + private final PipelineTemplateDefinitionsClient innerClient; + + private final com.azure.resourcemanager.devops.DevopsManager serviceManager; + + public PipelineTemplateDefinitionsImpl( + PipelineTemplateDefinitionsClient innerClient, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PipelineTemplateDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PipelineTemplateDefinitionImpl(inner1, this.manager())); + } + + private PipelineTemplateDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devops.DevopsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesClientImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesClientImpl.java new file mode 100644 index 0000000000000..691c96271ea00 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesClientImpl.java @@ -0,0 +1,1382 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.devops.fluent.PipelinesClient; +import com.azure.resourcemanager.devops.fluent.models.PipelineInner; +import com.azure.resourcemanager.devops.models.PipelineListResult; +import com.azure.resourcemanager.devops.models.PipelineUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PipelinesClient. */ +public final class PipelinesClientImpl implements PipelinesClient { + private final ClientLogger logger = new ClientLogger(PipelinesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PipelinesService service; + + /** The service client containing this operation class. */ + private final AzureDevOpsImpl client; + + /** + * Initializes an instance of PipelinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PipelinesClientImpl(AzureDevOpsImpl client) { + this.service = + RestProxy.create(PipelinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AzureDevOpsPipelines to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AzureDevOpsPipelines") + private interface PipelinesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines" + + "/{pipelineName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("pipelineName") String pipelineName, + @BodyParam("application/json") PipelineInner createOperationParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines" + + "/{pipelineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("pipelineName") String pipelineName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines" + + "/{pipelineName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("pipelineName") String pipelineName, + @BodyParam("application/json") PipelineUpdateParameters updateOperationParameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines" + + "/{pipelineName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("pipelineName") String pipelineName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevOps/pipelines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DevOps/pipelines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + if (createOperationParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createOperationParameters is required and cannot be null.")); + } else { + createOperationParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + createOperationParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + if (createOperationParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter createOperationParameters is required and cannot be null.")); + } else { + createOperationParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + createOperationParameters, + accept, + context); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PipelineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, pipelineName, createOperationParameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PipelineInner.class, + PipelineInner.class, + this.client.getContext()); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PipelineInner> beginCreateOrUpdateAsync( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, pipelineName, createOperationParameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PipelineInner.class, PipelineInner.class, context); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PipelineInner> beginCreateOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, pipelineName, createOperationParameters).getSyncPoller(); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PipelineInner> beginCreateOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, pipelineName, createOperationParameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters) { + return beginCreateOrUpdateAsync(resourceGroupName, pipelineName, createOperationParameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, pipelineName, createOperationParameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PipelineInner createOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters) { + return createOrUpdateAsync(resourceGroupName, pipelineName, createOperationParameters).block(); + } + + /** + * Creates or updates an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param createOperationParameters The request payload to create the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PipelineInner createOrUpdate( + String resourceGroupName, String pipelineName, PipelineInner createOperationParameters, Context context) { + return createOrUpdateAsync(resourceGroupName, pipelineName, createOperationParameters, context).block(); + } + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String pipelineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String pipelineName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + accept, + context); + } + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String pipelineName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, pipelineName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PipelineInner getByResourceGroup(String resourceGroupName, String pipelineName) { + return getByResourceGroupAsync(resourceGroupName, pipelineName).block(); + } + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String pipelineName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, pipelineName, context).block(); + } + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String pipelineName, PipelineUpdateParameters updateOperationParameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + if (updateOperationParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateOperationParameters is required and cannot be null.")); + } else { + updateOperationParameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + updateOperationParameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String pipelineName, + PipelineUpdateParameters updateOperationParameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + if (updateOperationParameters == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter updateOperationParameters is required and cannot be null.")); + } else { + updateOperationParameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + updateOperationParameters, + accept, + context); + } + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String pipelineName, PipelineUpdateParameters updateOperationParameters) { + return updateWithResponseAsync(resourceGroupName, pipelineName, updateOperationParameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PipelineInner update( + String resourceGroupName, String pipelineName, PipelineUpdateParameters updateOperationParameters) { + return updateAsync(resourceGroupName, pipelineName, updateOperationParameters).block(); + } + + /** + * Updates the properties of an Azure Pipeline. Currently, only tags can be updated. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param updateOperationParameters The request payload containing the properties to update in the Azure Pipeline. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return azure DevOps Pipeline used to configure Continuous Integration (CI) & Continuous Delivery (CD) for + * Azure resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String pipelineName, + PipelineUpdateParameters updateOperationParameters, + Context context) { + return updateWithResponseAsync(resourceGroupName, pipelineName, updateOperationParameters, context).block(); + } + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String pipelineName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String pipelineName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (pipelineName == null) { + return Mono.error(new IllegalArgumentException("Parameter pipelineName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + pipelineName, + accept, + context); + } + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String pipelineName) { + return deleteWithResponseAsync(resourceGroupName, pipelineName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String pipelineName) { + deleteAsync(resourceGroupName, pipelineName).block(); + } + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String pipelineName, Context context) { + return deleteWithResponseAsync(resourceGroupName, pipelineName, context).block(); + } + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesImpl.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesImpl.java new file mode 100644 index 0000000000000..02180d9a40a2f --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/PipelinesImpl.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.PipelinesClient; +import com.azure.resourcemanager.devops.fluent.models.PipelineInner; +import com.azure.resourcemanager.devops.models.Pipeline; +import com.azure.resourcemanager.devops.models.Pipelines; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PipelinesImpl implements Pipelines { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelinesImpl.class); + + private final PipelinesClient innerClient; + + private final com.azure.resourcemanager.devops.DevopsManager serviceManager; + + public PipelinesImpl(PipelinesClient innerClient, com.azure.resourcemanager.devops.DevopsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Pipeline getByResourceGroup(String resourceGroupName, String pipelineName) { + PipelineInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, pipelineName); + if (inner != null) { + return new PipelineImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String pipelineName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, pipelineName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PipelineImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String pipelineName) { + this.serviceClient().delete(resourceGroupName, pipelineName); + } + + public Response deleteWithResponse(String resourceGroupName, String pipelineName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, pipelineName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new PipelineImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new PipelineImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PipelineImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new PipelineImpl(inner1, this.manager())); + } + + public Pipeline getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String pipelineName = Utils.getValueFromIdByName(id, "pipelines"); + if (pipelineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pipelines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, pipelineName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String pipelineName = Utils.getValueFromIdByName(id, "pipelines"); + if (pipelineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pipelines'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, pipelineName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String pipelineName = Utils.getValueFromIdByName(id, "pipelines"); + if (pipelineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pipelines'.", id))); + } + this.deleteWithResponse(resourceGroupName, pipelineName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String pipelineName = Utils.getValueFromIdByName(id, "pipelines"); + if (pipelineName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'pipelines'.", id))); + } + return this.deleteWithResponse(resourceGroupName, pipelineName, context); + } + + private PipelinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.devops.DevopsManager manager() { + return this.serviceManager; + } + + public PipelineImpl define(String name) { + return new PipelineImpl(name, this.manager()); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/Utils.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/Utils.java new file mode 100644 index 0000000000000..766b7e7bc1f47 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/package-info.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/package-info.java new file mode 100644 index 0000000000000..7b0fa1def5d9f --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for AzureDevOps. Azure DevOps Resource Provider. */ +package com.azure.resourcemanager.devops.implementation; diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Authorization.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Authorization.java new file mode 100644 index 0000000000000..ff6bbd11c9e46 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Authorization.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Authorization info used to access a resource (like code repository). */ +@Fluent +public final class Authorization { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Authorization.class); + + /* + * Type of authorization. + */ + @JsonProperty(value = "authorizationType", required = true) + private AuthorizationType authorizationType; + + /* + * Authorization parameters corresponding to the authorization type. + */ + @JsonProperty(value = "parameters") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map parameters; + + /** + * Get the authorizationType property: Type of authorization. + * + * @return the authorizationType value. + */ + public AuthorizationType authorizationType() { + return this.authorizationType; + } + + /** + * Set the authorizationType property: Type of authorization. + * + * @param authorizationType the authorizationType value to set. + * @return the Authorization object itself. + */ + public Authorization withAuthorizationType(AuthorizationType authorizationType) { + this.authorizationType = authorizationType; + return this; + } + + /** + * Get the parameters property: Authorization parameters corresponding to the authorization type. + * + * @return the parameters value. + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Authorization parameters corresponding to the authorization type. + * + * @param parameters the parameters value to set. + * @return the Authorization object itself. + */ + public Authorization withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authorizationType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property authorizationType in model Authorization")); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/AuthorizationType.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/AuthorizationType.java new file mode 100644 index 0000000000000..149021076a779 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/AuthorizationType.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AuthorizationType. */ +public final class AuthorizationType extends ExpandableStringEnum { + /** Static value personalAccessToken for AuthorizationType. */ + public static final AuthorizationType PERSONAL_ACCESS_TOKEN = fromString("personalAccessToken"); + + /** + * Creates or finds a AuthorizationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AuthorizationType. + */ + @JsonCreator + public static AuthorizationType fromString(String name) { + return fromString(name, AuthorizationType.class); + } + + /** @return known AuthorizationType values. */ + public static Collection values() { + return values(AuthorizationType.class); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/BootstrapConfiguration.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/BootstrapConfiguration.java new file mode 100644 index 0000000000000..ddb3b2ded94dd --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/BootstrapConfiguration.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Configuration used to bootstrap a Pipeline. */ +@Fluent +public final class BootstrapConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BootstrapConfiguration.class); + + /* + * Repository containing the source code for the pipeline. + */ + @JsonProperty(value = "repository") + private CodeRepository repository; + + /* + * Template used to bootstrap the pipeline. + */ + @JsonProperty(value = "template", required = true) + private PipelineTemplate template; + + /** + * Get the repository property: Repository containing the source code for the pipeline. + * + * @return the repository value. + */ + public CodeRepository repository() { + return this.repository; + } + + /** + * Set the repository property: Repository containing the source code for the pipeline. + * + * @param repository the repository value to set. + * @return the BootstrapConfiguration object itself. + */ + public BootstrapConfiguration withRepository(CodeRepository repository) { + this.repository = repository; + return this; + } + + /** + * Get the template property: Template used to bootstrap the pipeline. + * + * @return the template value. + */ + public PipelineTemplate template() { + return this.template; + } + + /** + * Set the template property: Template used to bootstrap the pipeline. + * + * @param template the template value to set. + * @return the BootstrapConfiguration object itself. + */ + public BootstrapConfiguration withTemplate(PipelineTemplate template) { + this.template = template; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (repository() != null) { + repository().validate(); + } + if (template() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property template in model BootstrapConfiguration")); + } else { + template().validate(); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepository.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepository.java new file mode 100644 index 0000000000000..f898cdcf0a0d2 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepository.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Repository containing the source code for a pipeline. */ +@Fluent +public final class CodeRepository { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CodeRepository.class); + + /* + * Type of code repository. + */ + @JsonProperty(value = "repositoryType", required = true) + private CodeRepositoryType repositoryType; + + /* + * Unique immutable identifier of the code repository. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Default branch used to configure Continuous Integration (CI) in the + * pipeline. + */ + @JsonProperty(value = "defaultBranch", required = true) + private String defaultBranch; + + /* + * Authorization info to access the code repository. + */ + @JsonProperty(value = "authorization") + private Authorization authorization; + + /* + * Repository-specific properties. + */ + @JsonProperty(value = "properties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** + * Get the repositoryType property: Type of code repository. + * + * @return the repositoryType value. + */ + public CodeRepositoryType repositoryType() { + return this.repositoryType; + } + + /** + * Set the repositoryType property: Type of code repository. + * + * @param repositoryType the repositoryType value to set. + * @return the CodeRepository object itself. + */ + public CodeRepository withRepositoryType(CodeRepositoryType repositoryType) { + this.repositoryType = repositoryType; + return this; + } + + /** + * Get the id property: Unique immutable identifier of the code repository. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Unique immutable identifier of the code repository. + * + * @param id the id value to set. + * @return the CodeRepository object itself. + */ + public CodeRepository withId(String id) { + this.id = id; + return this; + } + + /** + * Get the defaultBranch property: Default branch used to configure Continuous Integration (CI) in the pipeline. + * + * @return the defaultBranch value. + */ + public String defaultBranch() { + return this.defaultBranch; + } + + /** + * Set the defaultBranch property: Default branch used to configure Continuous Integration (CI) in the pipeline. + * + * @param defaultBranch the defaultBranch value to set. + * @return the CodeRepository object itself. + */ + public CodeRepository withDefaultBranch(String defaultBranch) { + this.defaultBranch = defaultBranch; + return this; + } + + /** + * Get the authorization property: Authorization info to access the code repository. + * + * @return the authorization value. + */ + public Authorization authorization() { + return this.authorization; + } + + /** + * Set the authorization property: Authorization info to access the code repository. + * + * @param authorization the authorization value to set. + * @return the CodeRepository object itself. + */ + public CodeRepository withAuthorization(Authorization authorization) { + this.authorization = authorization; + return this; + } + + /** + * Get the properties property: Repository-specific properties. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: Repository-specific properties. + * + * @param properties the properties value to set. + * @return the CodeRepository object itself. + */ + public CodeRepository withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (repositoryType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property repositoryType in model CodeRepository")); + } + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model CodeRepository")); + } + if (defaultBranch() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property defaultBranch in model CodeRepository")); + } + if (authorization() != null) { + authorization().validate(); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepositoryType.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepositoryType.java new file mode 100644 index 0000000000000..157415322e9fc --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/CodeRepositoryType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CodeRepositoryType. */ +public final class CodeRepositoryType extends ExpandableStringEnum { + /** Static value gitHub for CodeRepositoryType. */ + public static final CodeRepositoryType GIT_HUB = fromString("gitHub"); + + /** Static value vstsGit for CodeRepositoryType. */ + public static final CodeRepositoryType VSTS_GIT = fromString("vstsGit"); + + /** + * Creates or finds a CodeRepositoryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CodeRepositoryType. + */ + @JsonCreator + public static CodeRepositoryType fromString(String name) { + return fromString(name, CodeRepositoryType.class); + } + + /** @return known CodeRepositoryType values. */ + public static Collection values() { + return values(CodeRepositoryType.class); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDataType.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDataType.java new file mode 100644 index 0000000000000..7093e381a4b31 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDataType.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InputDataType. */ +public final class InputDataType extends ExpandableStringEnum { + /** Static value String for InputDataType. */ + public static final InputDataType STRING = fromString("String"); + + /** Static value SecureString for InputDataType. */ + public static final InputDataType SECURE_STRING = fromString("SecureString"); + + /** Static value Int for InputDataType. */ + public static final InputDataType INT = fromString("Int"); + + /** Static value Bool for InputDataType. */ + public static final InputDataType BOOL = fromString("Bool"); + + /** Static value Authorization for InputDataType. */ + public static final InputDataType AUTHORIZATION = fromString("Authorization"); + + /** + * Creates or finds a InputDataType from its string representation. + * + * @param name a name to look for. + * @return the corresponding InputDataType. + */ + @JsonCreator + public static InputDataType fromString(String name) { + return fromString(name, InputDataType.class); + } + + /** @return known InputDataType values. */ + public static Collection values() { + return values(InputDataType.class); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDescriptor.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDescriptor.java new file mode 100644 index 0000000000000..1d45abaecdf24 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputDescriptor.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Representation of a pipeline template input parameter. */ +@Fluent +public final class InputDescriptor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InputDescriptor.class); + + /* + * Identifier of the input parameter. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Description of the input parameter. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Data type of the value of the input parameter. + */ + @JsonProperty(value = "type", required = true) + private InputDataType type; + + /* + * List of possible values for the input parameter. + */ + @JsonProperty(value = "possibleValues") + private List possibleValues; + + /** + * Get the id property: Identifier of the input parameter. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Identifier of the input parameter. + * + * @param id the id value to set. + * @return the InputDescriptor object itself. + */ + public InputDescriptor withId(String id) { + this.id = id; + return this; + } + + /** + * Get the description property: Description of the input parameter. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the input parameter. + * + * @param description the description value to set. + * @return the InputDescriptor object itself. + */ + public InputDescriptor withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the type property: Data type of the value of the input parameter. + * + * @return the type value. + */ + public InputDataType type() { + return this.type; + } + + /** + * Set the type property: Data type of the value of the input parameter. + * + * @param type the type value to set. + * @return the InputDescriptor object itself. + */ + public InputDescriptor withType(InputDataType type) { + this.type = type; + return this; + } + + /** + * Get the possibleValues property: List of possible values for the input parameter. + * + * @return the possibleValues value. + */ + public List possibleValues() { + return this.possibleValues; + } + + /** + * Set the possibleValues property: List of possible values for the input parameter. + * + * @param possibleValues the possibleValues value to set. + * @return the InputDescriptor object itself. + */ + public InputDescriptor withPossibleValues(List possibleValues) { + this.possibleValues = possibleValues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model InputDescriptor")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model InputDescriptor")); + } + if (possibleValues() != null) { + possibleValues().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputValue.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputValue.java new file mode 100644 index 0000000000000..f06df88914e73 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/InputValue.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Representation of a pipeline template input parameter value. */ +@Fluent +public final class InputValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InputValue.class); + + /* + * Value of an input parameter. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Description of the input parameter value. + */ + @JsonProperty(value = "displayValue") + private String displayValue; + + /** + * Get the value property: Value of an input parameter. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of an input parameter. + * + * @param value the value value to set. + * @return the InputValue object itself. + */ + public InputValue withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the displayValue property: Description of the input parameter value. + * + * @return the displayValue value. + */ + public String displayValue() { + return this.displayValue; + } + + /** + * Set the displayValue property: Description of the input parameter value. + * + * @param displayValue the displayValue value to set. + * @return the InputValue object itself. + */ + public InputValue withDisplayValue(String displayValue) { + this.displayValue = displayValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operation.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operation.java new file mode 100644 index 0000000000000..d6244109be89b --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operation.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.resourcemanager.devops.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation applies to data-plane. + * + * @return the isDataAction value. + */ + String isDataAction(); + + /** + * Gets the operation property: Friendly name of the operation. + * + * @return the operation value. + */ + String operation(); + + /** + * Gets the resource property: Friendly name of the resource type the operation applies to. + * + * @return the resource value. + */ + String resource(); + + /** + * Gets the description property: Friendly description of the operation. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provider property: Friendly name of the resource provider. + * + * @return the provider value. + */ + String provider(); + + /** + * Gets the inner com.azure.resourcemanager.devops.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OperationListResult.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OperationListResult.java new file mode 100644 index 0000000000000..bcb0cd29d2fc9 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OperationListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of a request to list all operations supported by Microsoft.DevOps resource provider. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by Microsoft.DevOps resource provider. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * The URL to get the next set of operations, if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of operations supported by Microsoft.DevOps resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URL to get the next set of operations, if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of operations, if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operations.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operations.java new file mode 100644 index 0000000000000..3865fe85b56bf --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + PagedIterable list(); + + /** + * Lists all the operations supported by Microsoft.DevOps resource provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all operations supported by Microsoft.DevOps resource provider. + */ + PagedIterable list(Context context); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OrganizationReference.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OrganizationReference.java new file mode 100644 index 0000000000000..54cbdeaee2211 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/OrganizationReference.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reference to an Azure DevOps Organization. */ +@Fluent +public final class OrganizationReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OrganizationReference.class); + + /* + * Unique immutable identifier for the Azure DevOps Organization. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Name of the Azure DevOps Organization. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the id property: Unique immutable identifier for the Azure DevOps Organization. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Name of the Azure DevOps Organization. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Azure DevOps Organization. + * + * @param name the name value to set. + * @return the OrganizationReference object itself. + */ + public OrganizationReference withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model OrganizationReference")); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipeline.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipeline.java new file mode 100644 index 0000000000000..e8557522dff33 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipeline.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.devops.fluent.models.PipelineInner; +import java.util.Map; + +/** An immutable client-side representation of Pipeline. */ +public interface Pipeline { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the pipelineId property: Unique identifier of the Azure Pipeline within the Azure DevOps Project. + * + * @return the pipelineId value. + */ + Integer pipelineId(); + + /** + * Gets the organization property: Reference to the Azure DevOps Organization containing the Pipeline. + * + * @return the organization value. + */ + OrganizationReference organization(); + + /** + * Gets the project property: Reference to the Azure DevOps Project containing the Pipeline. + * + * @return the project value. + */ + ProjectReference project(); + + /** + * Gets the bootstrapConfiguration property: Configuration used to bootstrap the Pipeline. + * + * @return the bootstrapConfiguration value. + */ + BootstrapConfiguration bootstrapConfiguration(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.devops.fluent.models.PipelineInner object. + * + * @return the inner object. + */ + PipelineInner innerModel(); + + /** The entirety of the Pipeline definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithOrganization, + DefinitionStages.WithProject, + DefinitionStages.WithBootstrapConfiguration, + DefinitionStages.WithCreate { + } + /** The Pipeline definition stages. */ + interface DefinitionStages { + /** The first stage of the Pipeline definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Pipeline definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Pipeline definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @return the next definition stage. + */ + WithOrganization withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Pipeline definition allowing to specify organization. */ + interface WithOrganization { + /** + * Specifies the organization property: Reference to the Azure DevOps Organization containing the Pipeline.. + * + * @param organization Reference to the Azure DevOps Organization containing the Pipeline. + * @return the next definition stage. + */ + WithProject withOrganization(OrganizationReference organization); + } + /** The stage of the Pipeline definition allowing to specify project. */ + interface WithProject { + /** + * Specifies the project property: Reference to the Azure DevOps Project containing the Pipeline.. + * + * @param project Reference to the Azure DevOps Project containing the Pipeline. + * @return the next definition stage. + */ + WithBootstrapConfiguration withProject(ProjectReference project); + } + /** The stage of the Pipeline definition allowing to specify bootstrapConfiguration. */ + interface WithBootstrapConfiguration { + /** + * Specifies the bootstrapConfiguration property: Configuration used to bootstrap the Pipeline.. + * + * @param bootstrapConfiguration Configuration used to bootstrap the Pipeline. + * @return the next definition stage. + */ + WithCreate withBootstrapConfiguration(BootstrapConfiguration bootstrapConfiguration); + } + /** + * The stage of the Pipeline definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + Pipeline create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Pipeline create(Context context); + } + /** The stage of the Pipeline definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the Pipeline resource. + * + * @return the stage of resource update. + */ + Pipeline.Update update(); + + /** The template for Pipeline update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Pipeline apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Pipeline apply(Context context); + } + /** The Pipeline update stages. */ + interface UpdateStages { + /** The stage of the Pipeline update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Dictionary of key-value pairs to be set as tags on the Azure Pipeline. This + * will overwrite any existing tags.. + * + * @param tags Dictionary of key-value pairs to be set as tags on the Azure Pipeline. This will overwrite + * any existing tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Pipeline refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Pipeline refresh(Context context); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineListResult.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineListResult.java new file mode 100644 index 0000000000000..8a1f8a01fa137 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.models.PipelineInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of a request to list all Azure Pipelines under a given scope. */ +@Fluent +public final class PipelineListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineListResult.class); + + /* + * List of pipelines. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of Pipelines, if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of pipelines. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of pipelines. + * + * @param value the value value to set. + * @return the PipelineListResult object itself. + */ + public PipelineListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of Pipelines, if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of Pipelines, if there are any. + * + * @param nextLink the nextLink value to set. + * @return the PipelineListResult object itself. + */ + public PipelineListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplate.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplate.java new file mode 100644 index 0000000000000..08b6b4851cdd3 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplate.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Template used to bootstrap the pipeline. */ +@Fluent +public final class PipelineTemplate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineTemplate.class); + + /* + * Unique identifier of the pipeline template. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Dictionary of input parameters used in the pipeline template. + */ + @JsonProperty(value = "parameters") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map parameters; + + /** + * Get the id property: Unique identifier of the pipeline template. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Unique identifier of the pipeline template. + * + * @param id the id value to set. + * @return the PipelineTemplate object itself. + */ + public PipelineTemplate withId(String id) { + this.id = id; + return this; + } + + /** + * Get the parameters property: Dictionary of input parameters used in the pipeline template. + * + * @return the parameters value. + */ + public Map parameters() { + return this.parameters; + } + + /** + * Set the parameters property: Dictionary of input parameters used in the pipeline template. + * + * @param parameters the parameters value to set. + * @return the PipelineTemplate object itself. + */ + public PipelineTemplate withParameters(Map parameters) { + this.parameters = parameters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model PipelineTemplate")); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinition.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinition.java new file mode 100644 index 0000000000000..39e22cddae1d6 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinition.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of PipelineTemplateDefinition. */ +public interface PipelineTemplateDefinition { + /** + * Gets the id property: Unique identifier of the pipeline template. + * + * @return the id value. + */ + String id(); + + /** + * Gets the description property: Description of the pipeline enabled by the template. + * + * @return the description value. + */ + String description(); + + /** + * Gets the inputs property: List of input parameters required by the template to create a pipeline. + * + * @return the inputs value. + */ + List inputs(); + + /** + * Gets the inner com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner object. + * + * @return the inner object. + */ + PipelineTemplateDefinitionInner innerModel(); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitionListResult.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitionListResult.java new file mode 100644 index 0000000000000..f5ffc217de508 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitionListResult.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.devops.fluent.models.PipelineTemplateDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Result of a request to list all pipeline template definitions. */ +@Fluent +public final class PipelineTemplateDefinitionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineTemplateDefinitionListResult.class); + + /* + * List of pipeline template definitions. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of pipeline template definitions, if there + * are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: List of pipeline template definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of pipeline template definitions. + * + * @param value the value value to set. + * @return the PipelineTemplateDefinitionListResult object itself. + */ + public PipelineTemplateDefinitionListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of pipeline template definitions, if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of pipeline template definitions, if there are any. + * + * @param nextLink the nextLink value to set. + * @return the PipelineTemplateDefinitionListResult object itself. + */ + public PipelineTemplateDefinitionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitions.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitions.java new file mode 100644 index 0000000000000..e7a629277e37e --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineTemplateDefinitions.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of PipelineTemplateDefinitions. */ +public interface PipelineTemplateDefinitions { + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + PagedIterable list(); + + /** + * Lists all pipeline templates which can be used to configure an Azure Pipeline. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all pipeline template definitions. + */ + PagedIterable list(Context context); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineUpdateParameters.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineUpdateParameters.java new file mode 100644 index 0000000000000..ebccad13582ed --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/PipelineUpdateParameters.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Request payload used to update an existing Azure Pipeline. */ +@Fluent +public final class PipelineUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PipelineUpdateParameters.class); + + /* + * Dictionary of key-value pairs to be set as tags on the Azure Pipeline. + * This will overwrite any existing tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Dictionary of key-value pairs to be set as tags on the Azure Pipeline. This will overwrite + * any existing tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of key-value pairs to be set as tags on the Azure Pipeline. This will overwrite + * any existing tags. + * + * @param tags the tags value to set. + * @return the PipelineUpdateParameters object itself. + */ + public PipelineUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipelines.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipelines.java new file mode 100644 index 0000000000000..8d17a83d65316 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/Pipelines.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Pipelines. */ +public interface Pipelines { + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + Pipeline getByResourceGroup(String resourceGroupName, String pipelineName); + + /** + * Gets an existing Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource in ARM. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String pipelineName, Context context); + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String pipelineName); + + /** + * Deletes an Azure Pipeline. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param pipelineName The name of the Azure Pipeline resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String pipelineName, Context context); + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all Azure Pipelines under the specified resource group. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + PagedIterable list(); + + /** + * Lists all Azure Pipelines under the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of a request to list all Azure Pipelines under a given scope. + */ + PagedIterable list(Context context); + + /** + * Gets an existing Azure Pipeline. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + Pipeline getById(String id); + + /** + * Gets an existing Azure Pipeline. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an existing Azure Pipeline. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Azure Pipeline. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Azure Pipeline. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Pipeline resource. + * + * @param name resource name. + * @return the first stage of the new Pipeline definition. + */ + Pipeline.DefinitionStages.Blank define(String name); +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/ProjectReference.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/ProjectReference.java new file mode 100644 index 0000000000000..93dddf0def1dd --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/ProjectReference.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Reference to an Azure DevOps Project. */ +@Fluent +public final class ProjectReference { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProjectReference.class); + + /* + * Unique immutable identifier of the Azure DevOps Project. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Name of the Azure DevOps Project. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** + * Get the id property: Unique immutable identifier of the Azure DevOps Project. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the name property: Name of the Azure DevOps Project. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the Azure DevOps Project. + * + * @param name the name value to set. + * @return the ProjectReference object itself. + */ + public ProjectReference withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ProjectReference")); + } + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/package-info.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/package-info.java new file mode 100644 index 0000000000000..436bd8f8e253c --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for AzureDevOps. Azure DevOps Resource Provider. */ +package com.azure.resourcemanager.devops.models; diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/package-info.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/package-info.java new file mode 100644 index 0000000000000..b897dc727927f --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/com/azure/resourcemanager/devops/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for AzureDevOps. Azure DevOps Resource Provider. */ +package com.azure.resourcemanager.devops; diff --git a/sdk/devops/azure-resourcemanager-devops/src/main/java/module-info.java b/sdk/devops/azure-resourcemanager-devops/src/main/java/module-info.java new file mode 100644 index 0000000000000..fbf953ae841f3 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.devops { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.devops; + exports com.azure.resourcemanager.devops.fluent; + exports com.azure.resourcemanager.devops.fluent.models; + exports com.azure.resourcemanager.devops.models; + + opens com.azure.resourcemanager.devops.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.devops.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/OperationsListSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..653cec3359ad6 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/OperationsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListOperations.json + */ + /** + * Sample code: Get a list of operations supported by Microsoft.DevOps resource provider. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAListOfOperationsSupportedByMicrosoftDevOpsResourceProvider( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelineTemplateDefinitionsListSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelineTemplateDefinitionsListSamples.java new file mode 100644 index 0000000000000..bf84df17da3a2 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelineTemplateDefinitionsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; + +/** Samples for PipelineTemplateDefinitions List. */ +public final class PipelineTemplateDefinitionsListSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListPipelineTemplateDefinitions.json + */ + /** + * Sample code: Get the list of pipeline template definitions. + * + * @param manager Entry point to DevopsManager. + */ + public static void getTheListOfPipelineTemplateDefinitions(com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelineTemplateDefinitions().list(Context.NONE); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesCreateOrUpdateSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1ade3dc381c29 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesCreateOrUpdateSamples.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.resourcemanager.devops.models.BootstrapConfiguration; +import com.azure.resourcemanager.devops.models.OrganizationReference; +import com.azure.resourcemanager.devops.models.PipelineTemplate; +import com.azure.resourcemanager.devops.models.ProjectReference; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Pipelines CreateOrUpdate. */ +public final class PipelinesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/CreateAzurePipeline-Sample-AspNet-WindowsWebApp.json + */ + /** + * Sample code: Create an Azure pipeline to deploy a sample ASP.Net application to Azure web-app. + * + * @param manager Entry point to DevopsManager. + */ + public static void createAnAzurePipelineToDeployASampleASPNetApplicationToAzureWebApp( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager + .pipelines() + .define("myAspNetWebAppPipeline") + .withRegion("South India") + .withExistingResourceGroup("myAspNetWebAppPipeline-rg") + .withOrganization(new OrganizationReference().withName("myAspNetWebAppPipeline-org")) + .withProject(new ProjectReference().withName("myAspNetWebAppPipeline-project")) + .withBootstrapConfiguration( + new BootstrapConfiguration() + .withTemplate( + new PipelineTemplate() + .withId("ms.vss-continuous-delivery-pipeline-templates.aspnet-windowswebapp") + .withParameters( + mapOf( + "appInsightLocation", + "South India", + "appServicePlan", + "S1 Standard", + "azureAuth", + "{\"scheme\":\"ServicePrincipal\",\"parameters\":{\"tenantid\":\"{subscriptionTenantId}\",\"objectid\":\"{appObjectId}\",\"serviceprincipalid\":\"{appId}\",\"serviceprincipalkey\":\"{appSecret}\"}}", + "location", + "South India", + "resourceGroup", + "myAspNetWebAppPipeline-rg", + "subscriptionId", + "{subscriptionId}", + "webAppName", + "myAspNetWebApp")))) + .withTags(mapOf()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesDeleteSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesDeleteSamples.java new file mode 100644 index 0000000000000..05cedf9fd1016 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; + +/** Samples for Pipelines Delete. */ +public final class PipelinesDeleteSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/DeleteAzurePipeline.json + */ + /** + * Sample code: Get an existing Azure pipeline. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelines().deleteWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesGetByResourceGroupSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..acb06b78175d5 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; + +/** Samples for Pipelines GetByResourceGroup. */ +public final class PipelinesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/GetAzurePipeline.json + */ + /** + * Sample code: Get an existing Azure pipeline. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) { + manager + .pipelines() + .getByResourceGroupWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListByResourceGroupSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..8a14d98b762fe --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; + +/** Samples for Pipelines ListByResourceGroup. */ +public final class PipelinesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListAzurePipelinesByResourceGroup.json + */ + /** + * Sample code: List all Azure Pipelines under the specified resource group. + * + * @param manager Entry point to DevopsManager. + */ + public static void listAllAzurePipelinesUnderTheSpecifiedResourceGroup( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelines().listByResourceGroup("myAspNetWebAppPipeline-rg", Context.NONE); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListSamples.java new file mode 100644 index 0000000000000..50a693c2083ad --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; + +/** Samples for Pipelines List. */ +public final class PipelinesListSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/ListAzurePipelinesBySubscription.json + */ + /** + * Sample code: List all Azure pipelines under the specified subscription. + * + * @param manager Entry point to DevopsManager. + */ + public static void listAllAzurePipelinesUnderTheSpecifiedSubscription( + com.azure.resourcemanager.devops.DevopsManager manager) { + manager.pipelines().list(Context.NONE); + } +} diff --git a/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesUpdateSamples.java b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesUpdateSamples.java new file mode 100644 index 0000000000000..7e4d915d8cd85 --- /dev/null +++ b/sdk/devops/azure-resourcemanager-devops/src/samples/java/com/azure/resourcemanager/devops/generated/PipelinesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.devops.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.devops.models.Pipeline; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Pipelines Update. */ +public final class PipelinesUpdateSamples { + /* + * x-ms-original-file: specification/devops/resource-manager/Microsoft.DevOps/preview/2019-07-01-preview/examples/UpdateAzurePipeline.json + */ + /** + * Sample code: Get an existing Azure pipeline. + * + * @param manager Entry point to DevopsManager. + */ + public static void getAnExistingAzurePipeline(com.azure.resourcemanager.devops.DevopsManager manager) { + Pipeline resource = + manager + .pipelines() + .getByResourceGroupWithResponse("myAspNetWebAppPipeline-rg", "myAspNetWebAppPipeline", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tagKey", "tagvalue")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/devops/ci.yml b/sdk/devops/ci.yml new file mode 100644 index 0000000000000..6761f350f92f7 --- /dev/null +++ b/sdk/devops/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/devops/ci.yml + - sdk/devops/azure-resourcemanager-devops/ + exclude: + - sdk/devops/pom.xml + - sdk/devops/azure-resourcemanager-devops/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/devops/ci.yml + - sdk/devops/azure-resourcemanager-devops/ + exclude: + - sdk/devops/pom.xml + - sdk/devops/azure-resourcemanager-devops/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: devops + Artifacts: + - name: azure-resourcemanager-devops + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdevops diff --git a/sdk/devops/pom.xml b/sdk/devops/pom.xml new file mode 100644 index 0000000000000..93d5ae64cac0b --- /dev/null +++ b/sdk/devops/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-devops-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-devops + + + +