diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 5a5204c3a915..8928cd059e27 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -516,6 +516,7 @@ com.azure.resourcemanager:azure-resourcemanager-workloadorchestration;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-disconnectedoperations;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-compute-recommender;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-computelimit;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-containerregistry-tasks;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/CHANGELOG.md b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/CHANGELOG.md new file mode 100644 index 000000000000..9b0232b98b33 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2026-01-22) + +- Azure Resource Manager Container Registry Tasks client library for Java. This package contains Microsoft Azure SDK for Container Registry Tasks Management SDK. The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. Package api-version 2025-03-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-containerregistry-tasks Java SDK. diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/README.md b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/README.md new file mode 100644 index 000000000000..27fd824c0348 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Container Registry Tasks client library for Java + +Azure Resource Manager Container Registry Tasks client library for Java. + +This package contains Microsoft Azure SDK for Container Registry Tasks Management SDK. The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. Package api-version 2025-03-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-containerregistry-tasks;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-containerregistry-tasks + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ContainerRegistryTasksManager manager = ContainerRegistryTasksManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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/containerregistry/azure-resourcemanager-containerregistry-tasks/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[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 +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/SAMPLE.md b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/SAMPLE.md new file mode 100644 index 000000000000..c6f83669e427 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/SAMPLE.md @@ -0,0 +1,1402 @@ +# Code snippets and samples + + +## AgentPools + +- [Create](#agentpools_create) +- [Delete](#agentpools_delete) +- [Get](#agentpools_get) +- [GetQueueStatus](#agentpools_getqueuestatus) +- [List](#agentpools_list) +- [Update](#agentpools_update) + +## Registries + +- [GetBuildSourceUploadUrl](#registries_getbuildsourceuploadurl) +- [ScheduleRun](#registries_schedulerun) + +## Runs + +- [Cancel](#runs_cancel) +- [Get](#runs_get) +- [GetLogSasUrl](#runs_getlogsasurl) +- [List](#runs_list) +- [Update](#runs_update) + +## TaskRuns + +- [Create](#taskruns_create) +- [Delete](#taskruns_delete) +- [Get](#taskruns_get) +- [GetDetails](#taskruns_getdetails) +- [List](#taskruns_list) +- [Update](#taskruns_update) + +## Tasks + +- [Create](#tasks_create) +- [Delete](#tasks_delete) +- [Get](#tasks_get) +- [GetDetails](#tasks_getdetails) +- [List](#tasks_list) +- [Update](#tasks_update) +### AgentPools_Create + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AgentPools Create. + */ +public final class AgentPoolsCreateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsCreate.json + */ + /** + * Sample code: AgentPools_Create. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsCreate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools() + .define("myAgentPool") + .withRegion("WESTUS") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("key", "fakeTokenPlaceholder")) + .withProperties(new AgentPoolProperties().withCount(1).withTier("S1").withOs(OS.LINUX)) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### AgentPools_Delete + +```java +/** + * Samples for AgentPools Delete. + */ +public final class AgentPoolsDeleteSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsDelete.json + */ + /** + * Sample code: AgentPools_Delete. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsDelete(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools().delete("myResourceGroup", "myRegistry", "myAgentPool", com.azure.core.util.Context.NONE); + } +} +``` + +### AgentPools_Get + +```java +/** + * Samples for AgentPools Get. + */ +public final class AgentPoolsGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsGet.json + */ + /** + * Sample code: AgentPools_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools() + .getWithResponse("myResourceGroup", "myRegistry", "myAgentPool", com.azure.core.util.Context.NONE); + } +} +``` + +### AgentPools_GetQueueStatus + +```java +/** + * Samples for AgentPools GetQueueStatus. + */ +public final class AgentPoolsGetQueueStatusSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsGetQueueStatus.json + */ + /** + * Sample code: AgentPools_GetQueueStatus. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void agentPoolsGetQueueStatus( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools() + .getQueueStatusWithResponse("myResourceGroup", "myRegistry", "myAgentPool", + com.azure.core.util.Context.NONE); + } +} +``` + +### AgentPools_List + +```java +/** + * Samples for AgentPools List. + */ +public final class AgentPoolsListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsList.json + */ + /** + * Sample code: AgentPools_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools().list("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} +``` + +### AgentPools_Update + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; + +/** + * Samples for AgentPools Update. + */ +public final class AgentPoolsUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsUpdate.json + */ + /** + * Sample code: AgentPools_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + AgentPool resource = manager.agentPools() + .getWithResponse("myResourceGroup", "myRegistry", "myAgentPool", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withCount(1).apply(); + } +} +``` + +### Registries_GetBuildSourceUploadUrl + +```java +/** + * Samples for Registries GetBuildSourceUploadUrl. + */ +public final class RegistriesGetBuildSourceUploadUrlSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesGetBuildSourceUploadUrl.json + */ + /** + * Sample code: Registries_GetBuildSourceUploadUrl. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesGetBuildSourceUploadUrl( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .getBuildSourceUploadUrlWithResponse("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} +``` + +### Registries_ScheduleRun + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Argument; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.CustomRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.FileTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.OverrideTaskStepProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObject; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType; +import com.azure.resourcemanager.containerregistry.tasks.models.SetValue; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryLoginMode; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunRequest; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Registries ScheduleRun. + */ +public final class RegistriesScheduleRunSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_FileTaskRun.json + */ + /** + * Sample code: Registries_ScheduleRun_FileTaskRun. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunFileTaskRun( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new FileTaskRunRequest() + .withTaskFilePath("acb.yaml") + .withValuesFilePath("prod-values.yaml") + .withValues(Arrays.asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun.json + */ + /** + * Sample code: Registries_ScheduleRun. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + registriesScheduleRun(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_EncodedTaskRun.json + */ + /** + * Sample code: Registries_ScheduleRun_EncodedTaskRun. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunEncodedTaskRun( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new EncodedTaskRunRequest() + .withEncodedTaskContent("fakeTokenPlaceholder") + .withEncodedValuesContent("fakeTokenPlaceholder") + .withValues(Arrays.asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withAgentConfiguration(new AgentProperties().withCpu(2)), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_WithCustomCredentials.json + */ + /** + * Sample code: Registries_ScheduleRun_WithCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunWithCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withTarget("stage1") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D") + .withCredentials(new Credentials() + .withSourceRegistry(new SourceRegistryCredentials().withLoginMode(SourceRegistryLoginMode.DEFAULT)) + .withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("reg1").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE)), + "myregistry2.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("reg2").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_WithLogTemplate.json + */ + /** + * Sample code: Registries_ScheduleRun_WithLogTemplate. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunWithLogTemplate( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_Task.json + */ + /** + * Sample code: Registries_ScheduleRun_Task. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunTask( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", + new TaskRunRequest().withTaskId("myTask") + .withOverrideTaskStepProperties(new OverrideTaskStepProperties().withFile("overriddenDockerfile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withTarget("build") + .withValues(Arrays.asList( + new SetValue().withName("mytestname").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestname") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withUpdateTriggerToken("fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_FileTask_WithCustomCredentials.json + */ + /** + * Sample code: Registries_ScheduleRun_Task_WithCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunTaskWithCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new FileTaskRunRequest() + .withTaskFilePath("acb.yaml") + .withValues(Arrays.asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withCredentials(new Credentials() + .withSourceRegistry(new SourceRegistryCredentials().withLoginMode(SourceRegistryLoginMode.DEFAULT)) + .withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("reg1").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Runs_Cancel + +```java +/** + * Samples for Runs Cancel. + */ +public final class RunsCancelSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsCancel.json + */ + /** + * Sample code: Runs_Cancel. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsCancel(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .cancelWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + com.azure.core.util.Context.NONE); + } +} +``` + +### Runs_Get + +```java +/** + * Samples for Runs Get. + */ +public final class RunsGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsGet.json + */ + /** + * Sample code: Runs_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .getWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + com.azure.core.util.Context.NONE); + } +} +``` + +### Runs_GetLogSasUrl + +```java +/** + * Samples for Runs GetLogSasUrl. + */ +public final class RunsGetLogSasUrlSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsGetLogSasUrl.json + */ + /** + * Sample code: Runs_GetLogSasUrl. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsGetLogSasUrl(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .getLogSasUrlWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + com.azure.core.util.Context.NONE); + } +} +``` + +### Runs_List + +```java +/** + * Samples for Runs List. + */ +public final class RunsListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsList.json + */ + /** + * Sample code: Runs_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs().list("myResourceGroup", "myRegistry", "", 10, com.azure.core.util.Context.NONE); + } +} +``` + +### Runs_Update + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters; + +/** + * Samples for Runs Update. + */ +public final class RunsUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsUpdate.json + */ + /** + * Sample code: Runs_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .updateWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + new RunUpdateParameters().withIsArchiveEnabled(true), com.azure.core.util.Context.NONE); + } +} +``` + +### TaskRuns_Create + +```java +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import java.util.Arrays; + +/** + * Samples for TaskRuns Create. + */ +public final class TaskRunsCreateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsCreate.json + */ + /** + * Sample code: TaskRuns_Create. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsCreate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns() + .define("myRun") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withProperties(new TaskRunPropertiesInner() + .withRunRequest(new EncodedTaskRunRequest().withEncodedTaskContent("fakeTokenPlaceholder") + .withEncodedValuesContent("fakeTokenPlaceholder") + .withValues(Arrays.asList()) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withCredentials(new Credentials())) + .withForceUpdateTag("test")) + .create(); + } +} +``` + +### TaskRuns_Delete + +```java +/** + * Samples for TaskRuns Delete. + */ +public final class TaskRunsDeleteSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsDelete.json + */ + /** + * Sample code: TaskRuns_Delete. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsDelete(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns() + .deleteWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE); + } +} +``` + +### TaskRuns_Get + +```java +/** + * Samples for TaskRuns Get. + */ +public final class TaskRunsGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsGet.json + */ + /** + * Sample code: TaskRuns_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns().getWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE); + } +} +``` + +### TaskRuns_GetDetails + +```java +/** + * Samples for TaskRuns GetDetails. + */ +public final class TaskRunsGetDetailsSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsGetDetails.json + */ + /** + * Sample code: TaskRuns_GetDetails. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsGetDetails(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns() + .getDetailsWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE); + } +} +``` + +### TaskRuns_List + +```java +/** + * Samples for TaskRuns List. + */ +public final class TaskRunsListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsList.json + */ + /** + * Sample code: TaskRuns_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns().list("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} +``` + +### TaskRuns_Update + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRun; +import java.util.Arrays; + +/** + * Samples for TaskRuns Update. + */ +public final class TaskRunsUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsUpdate.json + */ + /** + * Sample code: TaskRuns_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + TaskRun resource = manager.taskRuns() + .getWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withRunRequest(new EncodedTaskRunRequest().withIsArchiveEnabled(true) + .withEncodedTaskContent("fakeTokenPlaceholder") + .withEncodedValuesContent("fakeTokenPlaceholder") + .withValues(Arrays.asList()) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withCredentials(new Credentials())) + .withForceUpdateTag("test") + .apply(); + } +} +``` + +### Tasks_Create + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Argument; +import com.azure.resourcemanager.containerregistry.tasks.models.AuthInfo; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerType; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStep; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.ResourceIdentityType; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceControlType; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerEvent; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.TimerTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.TokenType; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.UpdateTriggerPayloadType; +import com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tasks Create. + */ +public final class TasksCreateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithSystemIdentity.json + */ + /** + * Sample code: Tasks_Create_WithUserIdentities_WithSystemIdentity. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithUserIdentitiesWithSystemIdentity( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithLoginIdentity.json + */ + /** + * Sample code: Tasks_Create_WithLoginIdentity. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithLoginIdentity( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withName("myBaseImageTrigger"))) + .withCredentials( + new Credentials().withSourceRegistry(new SourceRegistryCredentials().withIdentity("[system]"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksCreate.json + */ + /** + * Sample code: Tasks_Create. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksCreate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.TOKEN) + .withName("myBaseImageTrigger"))) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithSystemAndUserIdentities.json + */ + /** + * Sample code: Tasks_Create_WithSystemAndUserIdentities. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithSystemAndUserIdentities( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithUserIdentities.json + */ + /** + * Sample code: Tasks_Create_WithUserIdentities. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithUserIdentities( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new UserIdentityProperties(), + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksCreate_QuickTask.json + */ + /** + * Sample code: Tasks_Create_QuickTask. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksCreateQuickTask(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("quicktask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withIsSystemTask(true)) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Tasks_Delete + +```java +/** + * Samples for Tasks Delete. + */ +public final class TasksDeleteSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksDelete.json + */ + /** + * Sample code: Tasks_Delete. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksDelete(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks().deleteWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE); + } +} +``` + +### Tasks_Get + +```java +/** + * Samples for Tasks Get. + */ +public final class TasksGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksGet.json + */ + /** + * Sample code: Tasks_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks().getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE); + } +} +``` + +### Tasks_GetDetails + +```java +/** + * Samples for Tasks GetDetails. + */ +public final class TasksGetDetailsSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksGetDetails.json + */ + /** + * Sample code: Tasks_GetDetails. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksGetDetails(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .getDetailsWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE); + } +} +``` + +### Tasks_List + +```java +/** + * Samples for Tasks List. + */ +public final class TasksListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksList.json + */ + /** + * Sample code: Tasks_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks().list("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} +``` + +### Tasks_Update + +```java +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.AuthInfoUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.CustomRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStepUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObject; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerEvent; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Task; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.TokenType; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerUpdateParameters; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tasks Update. + */ +public final class TasksUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksUpdate_WithLoginIdentity.json + */ + /** + * Sample code: Tasks_Update_WithLoginIdentity. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithLoginIdentity( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials( + new Credentials().withSourceRegistry(new SourceRegistryCredentials().withIdentity("[system]"))) + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksUpdate_QuickTask.json + */ + /** + * Sample code: Tasks_Update_QuickTask. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksUpdateQuickTask(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "quicktask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithMSICustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithMSICustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries( + mapOf("myregistry.azurecr.io", new CustomRegistryCredentials().withIdentity("[system]")))) + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksUpdate_WithKeyVaultCustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithKeyVaultCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithKeyVaultCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("https://myacbvault.vault.azure.net/secrets/username") + .withType(SecretObjectType.VAULTSECRET)) + .withPassword(new SecretObject().withValue("https://myacbvault.vault.azure.net/secrets/password") + .withType(SecretObjectType.VAULTSECRET)) + .withIdentity("[system]")))) + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksUpdate.json + */ + /** + * Sample code: Tasks_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("username").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("https://myacbvault.vault.azure.net/secrets/password") + .withType(SecretObjectType.VAULTSECRET)) + .withIdentity("[system]")))) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksUpdate_WithOpaqueCustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithOpaqueCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithOpaqueCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("username").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))) + .apply(); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/pom.xml b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/pom.xml new file mode 100644 index 000000000000..65bf3e51d282 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-containerregistry-tasks + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Container Registry Tasks Management + This package contains Microsoft Azure SDK for Container Registry Tasks Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. Package api-version 2025-03-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 + 0 + 0 + true + + + + com.azure + azure-core + 1.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/ContainerRegistryTasksManager.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/ContainerRegistryTasksManager.java new file mode 100644 index 000000000000..673d30506883 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/ContainerRegistryTasksManager.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks; + +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.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +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.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerregistry.tasks.fluent.ContainerRegistryTasksManagementClient; +import com.azure.resourcemanager.containerregistry.tasks.implementation.AgentPoolsImpl; +import com.azure.resourcemanager.containerregistry.tasks.implementation.ContainerRegistryTasksManagementClientBuilder; +import com.azure.resourcemanager.containerregistry.tasks.implementation.RegistriesImpl; +import com.azure.resourcemanager.containerregistry.tasks.implementation.RunsImpl; +import com.azure.resourcemanager.containerregistry.tasks.implementation.TaskRunsImpl; +import com.azure.resourcemanager.containerregistry.tasks.implementation.TasksImpl; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPools; +import com.azure.resourcemanager.containerregistry.tasks.models.Registries; +import com.azure.resourcemanager.containerregistry.tasks.models.Runs; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRuns; +import com.azure.resourcemanager.containerregistry.tasks.models.Tasks; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to ContainerRegistryTasksManager. + * The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for + * Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry + * components. + */ +public final class ContainerRegistryTasksManager { + private AgentPools agentPools; + + private Runs runs; + + private TaskRuns taskRuns; + + private Tasks tasks; + + private Registries registries; + + private final ContainerRegistryTasksManagementClient clientObject; + + private ContainerRegistryTasksManager(HttpPipeline httpPipeline, AzureProfile profile, + Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new ContainerRegistryTasksManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Container Registry Tasks service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Container Registry Tasks service API instance. + */ + public static ContainerRegistryTasksManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Container Registry Tasks service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Container Registry Tasks service API instance. + */ + public static ContainerRegistryTasksManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new ContainerRegistryTasksManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create ContainerRegistryTasksManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ContainerRegistryTasksManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-containerregistry-tasks.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + 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 retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Container Registry Tasks service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Container Registry Tasks service API instance. + */ + public ContainerRegistryTasksManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.containerregistry.tasks") + .append("/") + .append(clientVersion); + 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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + 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 BearerTokenAuthenticationPolicy(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 ContainerRegistryTasksManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of AgentPools. It manages AgentPool. + * + * @return Resource collection API of AgentPools. + */ + public AgentPools agentPools() { + if (this.agentPools == null) { + this.agentPools = new AgentPoolsImpl(clientObject.getAgentPools(), this); + } + return agentPools; + } + + /** + * Gets the resource collection API of Runs. + * + * @return Resource collection API of Runs. + */ + public Runs runs() { + if (this.runs == null) { + this.runs = new RunsImpl(clientObject.getRuns(), this); + } + return runs; + } + + /** + * Gets the resource collection API of TaskRuns. It manages TaskRun. + * + * @return Resource collection API of TaskRuns. + */ + public TaskRuns taskRuns() { + if (this.taskRuns == null) { + this.taskRuns = new TaskRunsImpl(clientObject.getTaskRuns(), this); + } + return taskRuns; + } + + /** + * Gets the resource collection API of Tasks. It manages Task. + * + * @return Resource collection API of Tasks. + */ + public Tasks tasks() { + if (this.tasks == null) { + this.tasks = new TasksImpl(clientObject.getTasks(), this); + } + return tasks; + } + + /** + * Gets the resource collection API of Registries. + * + * @return Resource collection API of Registries. + */ + public Registries registries() { + if (this.registries == null) { + this.registries = new RegistriesImpl(clientObject.getRegistries(), this); + } + return registries; + } + + /** + * Gets wrapped service client ContainerRegistryTasksManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client ContainerRegistryTasksManagementClient. + */ + public ContainerRegistryTasksManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/AgentPoolsClient.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/AgentPoolsClient.java new file mode 100644 index 000000000000..4cd60dda3429 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/AgentPoolsClient.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.containerregistry.tasks.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined in AgentPoolsClient. + */ +public interface AgentPoolsClient { + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String registryName, String agentPoolName, + Context context); + + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentPoolInner get(String resourceGroupName, String registryName, String agentPoolName); + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgentPoolInner> beginCreate(String resourceGroupName, String registryName, + String agentPoolName, AgentPoolInner agentPool); + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgentPoolInner> beginCreate(String resourceGroupName, String registryName, + String agentPoolName, AgentPoolInner agentPool, Context context); + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentPoolInner create(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolInner agentPool); + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentPoolInner create(String resourceGroupName, String registryName, String agentPoolName, AgentPoolInner agentPool, + Context context); + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgentPoolInner> beginUpdate(String resourceGroupName, String registryName, + String agentPoolName, AgentPoolUpdateParameters updateParameters); + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AgentPoolInner> beginUpdate(String resourceGroupName, String registryName, + String agentPoolName, AgentPoolUpdateParameters updateParameters, Context context); + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentPoolInner update(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters); + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentPoolInner update(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters, Context context); + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String registryName, String agentPoolName); + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String registryName, String agentPoolName, + Context context); + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 registryName, String agentPoolName); + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String registryName, String agentPoolName, Context context); + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName, Context context); + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getQueueStatusWithResponse(String resourceGroupName, String registryName, + String agentPoolName, Context context); + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AgentPoolQueueStatusInner getQueueStatus(String resourceGroupName, String registryName, String agentPoolName); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/ContainerRegistryTasksManagementClient.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/ContainerRegistryTasksManagementClient.java new file mode 100644 index 000000000000..3c0af73fdc9d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/ContainerRegistryTasksManagementClient.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for ContainerRegistryTasksManagementClient class. + */ +public interface ContainerRegistryTasksManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * 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 AgentPoolsClient object to access its operations. + * + * @return the AgentPoolsClient object. + */ + AgentPoolsClient getAgentPools(); + + /** + * Gets the RunsClient object to access its operations. + * + * @return the RunsClient object. + */ + RunsClient getRuns(); + + /** + * Gets the TaskRunsClient object to access its operations. + * + * @return the TaskRunsClient object. + */ + TaskRunsClient getTaskRuns(); + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + TasksClient getTasks(); + + /** + * Gets the RegistriesClient object to access its operations. + * + * @return the RegistriesClient object. + */ + RegistriesClient getRegistries(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RegistriesClient.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RegistriesClient.java new file mode 100644 index 000000000000..d147760baaaa --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RegistriesClient.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; + +/** + * An instance of this class provides access to all the operations defined in RegistriesClient. + */ +public interface RegistriesClient { + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response scheduleRunWithResponse(String resourceGroupName, String registryName, RunRequest runRequest, + Context context); + + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RunInner scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest); + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getBuildSourceUploadUrlWithResponse(String resourceGroupName, + String registryName, Context context); + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SourceUploadDefinitionInner getBuildSourceUploadUrl(String resourceGroupName, String registryName); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RunsClient.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RunsClient.java new file mode 100644 index 000000000000..c15957c493b8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RunsClient.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined in RunsClient. + */ +public interface RunsClient { + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 detailed information for a given run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String registryName, String runId, Context context); + + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 the detailed information for a given run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RunInner get(String resourceGroupName, String registryName, String runId); + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters, Context context); + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RunInner update(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters); + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 all the runs for a registry as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName, String filter, Integer top, + Context context); + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 a link to download the run logs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getLogSasUrlWithResponse(String resourceGroupName, String registryName, String runId, + Context context); + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 a link to download the run logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RunGetLogResultInner getLogSasUrl(String resourceGroupName, String registryName, String runId); + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response cancelWithResponse(String resourceGroupName, String registryName, String runId, Context context); + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(String resourceGroupName, String registryName, String runId); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TaskRunsClient.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TaskRunsClient.java new file mode 100644 index 000000000000..64eb8f42933d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TaskRunsClient.java @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.containerregistry.tasks.fluent.models.TaskRunInner; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined in TaskRunsClient. + */ +public interface TaskRunsClient { + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context); + + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskRunInner get(String resourceGroupName, String registryName, String taskRunName); + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TaskRunInner> beginCreate(String resourceGroupName, String registryName, + String taskRunName, TaskRunInner taskRun); + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TaskRunInner> beginCreate(String resourceGroupName, String registryName, + String taskRunName, TaskRunInner taskRun, Context context); + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskRunInner create(String resourceGroupName, String registryName, String taskRunName, TaskRunInner taskRun); + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskRunInner create(String resourceGroupName, String registryName, String taskRunName, TaskRunInner taskRun, + Context context); + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TaskRunInner> beginUpdate(String resourceGroupName, String registryName, + String taskRunName, TaskRunUpdateParameters updateParameters); + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TaskRunInner> beginUpdate(String resourceGroupName, String registryName, + String taskRunName, TaskRunUpdateParameters updateParameters, Context context); + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskRunInner update(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters); + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskRunInner update(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters, Context context); + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context); + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 registryName, String taskRunName); + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName, Context context); + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context); + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskRunInner getDetails(String resourceGroupName, String registryName, String taskRunName); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TasksClient.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TasksClient.java new file mode 100644 index 000000000000..bd885fde97ce --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TasksClient.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskUpdateParameters; + +/** + * An instance of this class provides access to all the operations defined in TasksClient. + */ +public interface TasksClient { + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String registryName, String taskName, + Context context); + + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskInner get(String resourceGroupName, String registryName, String taskName); + + /** + * Creates a task for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskCreateParameters The parameters for creating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String registryName, String taskName, + TaskInner taskCreateParameters, Context context); + + /** + * Creates a task for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskCreateParameters The parameters for creating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskInner create(String resourceGroupName, String registryName, String taskName, TaskInner taskCreateParameters); + + /** + * Updates a task with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskUpdateParameters The parameters for updating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String registryName, String taskName, + TaskUpdateParameters taskUpdateParameters, Context context); + + /** + * Updates a task with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskUpdateParameters The parameters for updating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskInner update(String resourceGroupName, String registryName, String taskName, + TaskUpdateParameters taskUpdateParameters); + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String registryName, String taskName, Context context); + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 registryName, String taskName); + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String registryName, Context context); + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskName, + Context context); + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TaskInner getDetails(String resourceGroupName, String registryName, String taskName); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolInner.java new file mode 100644 index 000000000000..0cdd63ac68e8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ +@Fluent +public final class AgentPoolInner extends Resource { + /* + * The properties associated with the agent pool + */ + private AgentPoolProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AgentPoolInner class. + */ + public AgentPoolInner() { + } + + /** + * Get the properties property: The properties associated with the agent pool. + * + * @return the properties value. + */ + public AgentPoolProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties associated with the agent pool. + * + * @param properties the properties value to set. + * @return the AgentPoolInner object itself. + */ + public AgentPoolInner withProperties(AgentPoolProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AgentPoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AgentPoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPoolInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPoolInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AgentPoolInner. + */ + public static AgentPoolInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPoolInner deserializedAgentPoolInner = new AgentPoolInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAgentPoolInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAgentPoolInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAgentPoolInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAgentPoolInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAgentPoolInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAgentPoolInner.properties = AgentPoolProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAgentPoolInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPoolInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolPropertiesUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolPropertiesUpdateParameters.java new file mode 100644 index 000000000000..79f4cb18da43 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolPropertiesUpdateParameters.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The AgentPoolPropertiesUpdateParameters model. + */ +@Fluent +public final class AgentPoolPropertiesUpdateParameters + implements JsonSerializable { + /* + * The count of agent machine + */ + private Integer count; + + /** + * Creates an instance of AgentPoolPropertiesUpdateParameters class. + */ + public AgentPoolPropertiesUpdateParameters() { + } + + /** + * Get the count property: The count of agent machine. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Set the count property: The count of agent machine. + * + * @param count the count value to set. + * @return the AgentPoolPropertiesUpdateParameters object itself. + */ + public AgentPoolPropertiesUpdateParameters withCount(Integer count) { + this.count = count; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("count", this.count); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPoolPropertiesUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPoolPropertiesUpdateParameters if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentPoolPropertiesUpdateParameters. + */ + public static AgentPoolPropertiesUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPoolPropertiesUpdateParameters deserializedAgentPoolPropertiesUpdateParameters + = new AgentPoolPropertiesUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedAgentPoolPropertiesUpdateParameters.count = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPoolPropertiesUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolQueueStatusInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolQueueStatusInner.java new file mode 100644 index 000000000000..5ded7b2ebf40 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolQueueStatusInner.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The QueueStatus of Agent Pool. + */ +@Immutable +public final class AgentPoolQueueStatusInner implements JsonSerializable { + /* + * The number of pending runs in the queue + */ + private Integer count; + + /** + * Creates an instance of AgentPoolQueueStatusInner class. + */ + private AgentPoolQueueStatusInner() { + } + + /** + * Get the count property: The number of pending runs in the queue. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("count", this.count); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPoolQueueStatusInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPoolQueueStatusInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentPoolQueueStatusInner. + */ + public static AgentPoolQueueStatusInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPoolQueueStatusInner deserializedAgentPoolQueueStatusInner = new AgentPoolQueueStatusInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedAgentPoolQueueStatusInner.count = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPoolQueueStatusInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunGetLogResultInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunGetLogResultInner.java new file mode 100644 index 000000000000..8e94f1fe8e20 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunGetLogResultInner.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The result of get log link operation. + */ +@Immutable +public final class RunGetLogResultInner implements JsonSerializable { + /* + * The link to logs for a run on a azure container registry. + */ + private String logLink; + + /* + * The link to logs in registry for a run on a azure container registry. + */ + private String logArtifactLink; + + /** + * Creates an instance of RunGetLogResultInner class. + */ + private RunGetLogResultInner() { + } + + /** + * Get the logLink property: The link to logs for a run on a azure container registry. + * + * @return the logLink value. + */ + public String logLink() { + return this.logLink; + } + + /** + * Get the logArtifactLink property: The link to logs in registry for a run on a azure container registry. + * + * @return the logArtifactLink value. + */ + public String logArtifactLink() { + return this.logArtifactLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("logLink", this.logLink); + jsonWriter.writeStringField("logArtifactLink", this.logArtifactLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunGetLogResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunGetLogResultInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the RunGetLogResultInner. + */ + public static RunGetLogResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunGetLogResultInner deserializedRunGetLogResultInner = new RunGetLogResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("logLink".equals(fieldName)) { + deserializedRunGetLogResultInner.logLink = reader.getString(); + } else if ("logArtifactLink".equals(fieldName)) { + deserializedRunGetLogResultInner.logArtifactLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRunGetLogResultInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunInner.java new file mode 100644 index 000000000000..43ceacbfada2 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunInner.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.RunProperties; +import java.io.IOException; + +/** + * Run resource properties. + */ +@Immutable +public final class RunInner extends ProxyResource { + /* + * The properties of a run. + */ + private RunProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RunInner class. + */ + private RunInner() { + } + + /** + * Get the properties property: The properties of a run. + * + * @return the properties value. + */ + public RunProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RunInner. + */ + public static RunInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunInner deserializedRunInner = new RunInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRunInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRunInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRunInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRunInner.properties = RunProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedRunInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRunInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/SourceUploadDefinitionInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/SourceUploadDefinitionInner.java new file mode 100644 index 000000000000..e82ecb09b5af --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/SourceUploadDefinitionInner.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a response to source upload request. + */ +@Immutable +public final class SourceUploadDefinitionInner implements JsonSerializable { + /* + * The URL where the client can upload the source. + */ + private String uploadUrl; + + /* + * The relative path to the source. This is used to submit the subsequent queue build request. + */ + private String relativePath; + + /** + * Creates an instance of SourceUploadDefinitionInner class. + */ + private SourceUploadDefinitionInner() { + } + + /** + * Get the uploadUrl property: The URL where the client can upload the source. + * + * @return the uploadUrl value. + */ + public String uploadUrl() { + return this.uploadUrl; + } + + /** + * Get the relativePath property: The relative path to the source. This is used to submit the subsequent queue build + * request. + * + * @return the relativePath value. + */ + public String relativePath() { + return this.relativePath; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("uploadUrl", this.uploadUrl); + jsonWriter.writeStringField("relativePath", this.relativePath); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceUploadDefinitionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceUploadDefinitionInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SourceUploadDefinitionInner. + */ + public static SourceUploadDefinitionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceUploadDefinitionInner deserializedSourceUploadDefinitionInner = new SourceUploadDefinitionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("uploadUrl".equals(fieldName)) { + deserializedSourceUploadDefinitionInner.uploadUrl = reader.getString(); + } else if ("relativePath".equals(fieldName)) { + deserializedSourceUploadDefinitionInner.relativePath = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceUploadDefinitionInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskInner.java new file mode 100644 index 000000000000..da8c8c2f75c3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskInner.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ +@Fluent +public final class TaskInner extends Resource { + /* + * The properties of a task. + */ + private TaskProperties properties; + + /* + * Identity for the resource. + */ + private IdentityProperties identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TaskInner class. + */ + public TaskInner() { + } + + /** + * Get the properties property: The properties of a task. + * + * @return the properties value. + */ + public TaskProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a task. + * + * @param properties the properties value to set. + * @return the TaskInner object itself. + */ + public TaskInner withProperties(TaskProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the TaskInner object itself. + */ + public TaskInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public TaskInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TaskInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TaskInner. + */ + public static TaskInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskInner deserializedTaskInner = new TaskInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTaskInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTaskInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTaskInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedTaskInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTaskInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedTaskInner.properties = TaskProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedTaskInner.identity = IdentityProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedTaskInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskPropertiesUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskPropertiesUpdateParameters.java new file mode 100644 index 000000000000..206c14612702 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskPropertiesUpdateParameters.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStepUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerUpdateParameters; +import java.io.IOException; + +/** + * The properties for updating a task. + */ +@Fluent +public final class TaskPropertiesUpdateParameters implements JsonSerializable { + /* + * The current status of task. + */ + private TaskStatus status; + + /* + * The platform properties against which the run has to happen. + */ + private PlatformUpdateParameters platform; + + /* + * The machine configuration of the run agent. + */ + private AgentProperties agentConfiguration; + + /* + * The dedicated agent pool for the task. + */ + private String agentPoolName; + + /* + * Run timeout in seconds. + */ + private Integer timeout; + + /* + * The properties for updating a task step. + */ + private TaskStepUpdateParameters step; + + /* + * The properties for updating trigger properties. + */ + private TriggerUpdateParameters trigger; + + /* + * The parameters that describes a set of credentials that will be used when this run is invoked. + */ + private Credentials credentials; + + /* + * The template that describes the repository and tag information for run log artifact. + */ + private String logTemplate; + + /** + * Creates an instance of TaskPropertiesUpdateParameters class. + */ + public TaskPropertiesUpdateParameters() { + } + + /** + * Get the status property: The current status of task. + * + * @return the status value. + */ + public TaskStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of task. + * + * @param status the status value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withStatus(TaskStatus status) { + this.status = status; + return this; + } + + /** + * Get the platform property: The platform properties against which the run has to happen. + * + * @return the platform value. + */ + public PlatformUpdateParameters platform() { + return this.platform; + } + + /** + * Set the platform property: The platform properties against which the run has to happen. + * + * @param platform the platform value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withPlatform(PlatformUpdateParameters platform) { + this.platform = platform; + return this; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.agentConfiguration; + } + + /** + * Set the agentConfiguration property: The machine configuration of the run agent. + * + * @param agentConfiguration the agentConfiguration value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withAgentConfiguration(AgentProperties agentConfiguration) { + this.agentConfiguration = agentConfiguration; + return this; + } + + /** + * Get the agentPoolName property: The dedicated agent pool for the task. + * + * @return the agentPoolName value. + */ + public String agentPoolName() { + return this.agentPoolName; + } + + /** + * Set the agentPoolName property: The dedicated agent pool for the task. + * + * @param agentPoolName the agentPoolName value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withAgentPoolName(String agentPoolName) { + this.agentPoolName = agentPoolName; + return this; + } + + /** + * Get the timeout property: Run timeout in seconds. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Run timeout in seconds. + * + * @param timeout the timeout value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the step property: The properties for updating a task step. + * + * @return the step value. + */ + public TaskStepUpdateParameters step() { + return this.step; + } + + /** + * Set the step property: The properties for updating a task step. + * + * @param step the step value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withStep(TaskStepUpdateParameters step) { + this.step = step; + return this; + } + + /** + * Get the trigger property: The properties for updating trigger properties. + * + * @return the trigger value. + */ + public TriggerUpdateParameters trigger() { + return this.trigger; + } + + /** + * Set the trigger property: The properties for updating trigger properties. + * + * @param trigger the trigger value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withTrigger(TriggerUpdateParameters trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get the credentials property: The parameters that describes a set of credentials that will be used when this run + * is invoked. + * + * @return the credentials value. + */ + public Credentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: The parameters that describes a set of credentials that will be used when this run + * is invoked. + * + * @param credentials the credentials value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withCredentials(Credentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @return the logTemplate value. + */ + public String logTemplate() { + return this.logTemplate; + } + + /** + * Set the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @param logTemplate the logTemplate value to set. + * @return the TaskPropertiesUpdateParameters object itself. + */ + public TaskPropertiesUpdateParameters withLogTemplate(String logTemplate) { + this.logTemplate = logTemplate; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("platform", this.platform); + jsonWriter.writeJsonField("agentConfiguration", this.agentConfiguration); + jsonWriter.writeStringField("agentPoolName", this.agentPoolName); + jsonWriter.writeNumberField("timeout", this.timeout); + jsonWriter.writeJsonField("step", this.step); + jsonWriter.writeJsonField("trigger", this.trigger); + jsonWriter.writeJsonField("credentials", this.credentials); + jsonWriter.writeStringField("logTemplate", this.logTemplate); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskPropertiesUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskPropertiesUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskPropertiesUpdateParameters. + */ + public static TaskPropertiesUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskPropertiesUpdateParameters deserializedTaskPropertiesUpdateParameters + = new TaskPropertiesUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.status = TaskStatus.fromString(reader.getString()); + } else if ("platform".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.platform = PlatformUpdateParameters.fromJson(reader); + } else if ("agentConfiguration".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.agentConfiguration = AgentProperties.fromJson(reader); + } else if ("agentPoolName".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.agentPoolName = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.timeout = reader.getNullable(JsonReader::getInt); + } else if ("step".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.step = TaskStepUpdateParameters.fromJson(reader); + } else if ("trigger".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.trigger = TriggerUpdateParameters.fromJson(reader); + } else if ("credentials".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.credentials = Credentials.fromJson(reader); + } else if ("logTemplate".equals(fieldName)) { + deserializedTaskPropertiesUpdateParameters.logTemplate = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskPropertiesUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunInner.java new file mode 100644 index 000000000000..ced3eb368e7d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunInner.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import java.io.IOException; + +/** + * The task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ +@Fluent +public final class TaskRunInner extends ProxyResource { + /* + * The properties associated with the task run, i.e., request and result of the run + */ + private TaskRunPropertiesInner properties; + + /* + * Identity for the resource. + */ + private IdentityProperties identity; + + /* + * The location of the resource + */ + private String location; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of TaskRunInner class. + */ + public TaskRunInner() { + } + + /** + * Get the properties property: The properties associated with the task run, i.e., request and result of the run. + * + * @return the properties value. + */ + public TaskRunPropertiesInner properties() { + return this.properties; + } + + /** + * Set the properties property: The properties associated with the task run, i.e., request and result of the run. + * + * @param properties the properties value to set. + * @return the TaskRunInner object itself. + */ + public TaskRunInner withProperties(TaskRunPropertiesInner properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the TaskRunInner object itself. + */ + public TaskRunInner withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** + * Get the location property: The location of the resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the resource. + * + * @param location the location value to set. + * @return the TaskRunInner object itself. + */ + public TaskRunInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskRunInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskRunInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TaskRunInner. + */ + public static TaskRunInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskRunInner deserializedTaskRunInner = new TaskRunInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedTaskRunInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTaskRunInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTaskRunInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedTaskRunInner.properties = TaskRunPropertiesInner.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedTaskRunInner.identity = IdentityProperties.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedTaskRunInner.location = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedTaskRunInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskRunInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesInner.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesInner.java new file mode 100644 index 000000000000..aa744265e93a --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.ProvisioningState; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import java.io.IOException; + +/** + * The properties of task run. + */ +@Fluent +public final class TaskRunPropertiesInner implements JsonSerializable { + /* + * The provisioning state of this task run + */ + private ProvisioningState provisioningState; + + /* + * The request (parameters) for the run + */ + private RunRequest runRequest; + + /* + * The result of this task run + */ + private RunInner runResult; + + /* + * How the run should be forced to rerun even if the run request configuration has not changed + */ + private String forceUpdateTag; + + /** + * Creates an instance of TaskRunPropertiesInner class. + */ + public TaskRunPropertiesInner() { + } + + /** + * Get the provisioningState property: The provisioning state of this task run. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the runRequest property: The request (parameters) for the run. + * + * @return the runRequest value. + */ + public RunRequest runRequest() { + return this.runRequest; + } + + /** + * Set the runRequest property: The request (parameters) for the run. + * + * @param runRequest the runRequest value to set. + * @return the TaskRunPropertiesInner object itself. + */ + public TaskRunPropertiesInner withRunRequest(RunRequest runRequest) { + this.runRequest = runRequest; + return this; + } + + /** + * Get the runResult property: The result of this task run. + * + * @return the runResult value. + */ + public RunInner runResult() { + return this.runResult; + } + + /** + * Get the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the TaskRunPropertiesInner object itself. + */ + public TaskRunPropertiesInner withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("runRequest", this.runRequest); + jsonWriter.writeStringField("forceUpdateTag", this.forceUpdateTag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskRunPropertiesInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskRunPropertiesInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskRunPropertiesInner. + */ + public static TaskRunPropertiesInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskRunPropertiesInner deserializedTaskRunPropertiesInner = new TaskRunPropertiesInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedTaskRunPropertiesInner.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("runRequest".equals(fieldName)) { + deserializedTaskRunPropertiesInner.runRequest = RunRequest.fromJson(reader); + } else if ("runResult".equals(fieldName)) { + deserializedTaskRunPropertiesInner.runResult = RunInner.fromJson(reader); + } else if ("forceUpdateTag".equals(fieldName)) { + deserializedTaskRunPropertiesInner.forceUpdateTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskRunPropertiesInner; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesUpdateParameters.java new file mode 100644 index 000000000000..ad2ffa71cb8b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesUpdateParameters.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import java.io.IOException; + +/** + * The properties of a task run update parameters. + */ +@Fluent +public final class TaskRunPropertiesUpdateParameters implements JsonSerializable { + /* + * The request (parameters) for the new run + */ + private RunRequest runRequest; + + /* + * How the run should be forced to rerun even if the run request configuration has not changed + */ + private String forceUpdateTag; + + /** + * Creates an instance of TaskRunPropertiesUpdateParameters class. + */ + public TaskRunPropertiesUpdateParameters() { + } + + /** + * Get the runRequest property: The request (parameters) for the new run. + * + * @return the runRequest value. + */ + public RunRequest runRequest() { + return this.runRequest; + } + + /** + * Set the runRequest property: The request (parameters) for the new run. + * + * @param runRequest the runRequest value to set. + * @return the TaskRunPropertiesUpdateParameters object itself. + */ + public TaskRunPropertiesUpdateParameters withRunRequest(RunRequest runRequest) { + this.runRequest = runRequest; + return this; + } + + /** + * Get the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.forceUpdateTag; + } + + /** + * Set the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the TaskRunPropertiesUpdateParameters object itself. + */ + public TaskRunPropertiesUpdateParameters withForceUpdateTag(String forceUpdateTag) { + this.forceUpdateTag = forceUpdateTag; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("runRequest", this.runRequest); + jsonWriter.writeStringField("forceUpdateTag", this.forceUpdateTag); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskRunPropertiesUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskRunPropertiesUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskRunPropertiesUpdateParameters. + */ + public static TaskRunPropertiesUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskRunPropertiesUpdateParameters deserializedTaskRunPropertiesUpdateParameters + = new TaskRunPropertiesUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("runRequest".equals(fieldName)) { + deserializedTaskRunPropertiesUpdateParameters.runRequest = RunRequest.fromJson(reader); + } else if ("forceUpdateTag".equals(fieldName)) { + deserializedTaskRunPropertiesUpdateParameters.forceUpdateTag = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskRunPropertiesUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/package-info.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/package-info.java new file mode 100644 index 000000000000..4fd445a8b0d1 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for ContainerRegistryTasks. + * The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for + * Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry + * components. + */ +package com.azure.resourcemanager.containerregistry.tasks.fluent.models; diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/package-info.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/package-info.java new file mode 100644 index 000000000000..b08462cb2d13 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for ContainerRegistryTasks. + * The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for + * Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry + * components. + */ +package com.azure.resourcemanager.containerregistry.tasks.fluent; diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolImpl.java new file mode 100644 index 000000000000..eda1c9f32e8b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolQueueStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolUpdateParameters; +import java.util.Collections; +import java.util.Map; + +public final class AgentPoolImpl implements AgentPool, AgentPool.Definition, AgentPool.Update { + private AgentPoolInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager 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 AgentPoolProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AgentPoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String registryName; + + private String agentPoolName; + + private AgentPoolUpdateParameters updateUpdateParameters; + + public AgentPoolImpl withExistingRegistry(String resourceGroupName, String registryName) { + this.resourceGroupName = resourceGroupName; + this.registryName = registryName; + return this; + } + + public AgentPool create() { + this.innerObject = serviceManager.serviceClient() + .getAgentPools() + .create(resourceGroupName, registryName, agentPoolName, this.innerModel(), Context.NONE); + return this; + } + + public AgentPool create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAgentPools() + .create(resourceGroupName, registryName, agentPoolName, this.innerModel(), context); + return this; + } + + AgentPoolImpl(String name, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = new AgentPoolInner(); + this.serviceManager = serviceManager; + this.agentPoolName = name; + } + + public AgentPoolImpl update() { + this.updateUpdateParameters = new AgentPoolUpdateParameters(); + return this; + } + + public AgentPool apply() { + this.innerObject = serviceManager.serviceClient() + .getAgentPools() + .update(resourceGroupName, registryName, agentPoolName, updateUpdateParameters, Context.NONE); + return this; + } + + public AgentPool apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAgentPools() + .update(resourceGroupName, registryName, agentPoolName, updateUpdateParameters, context); + return this; + } + + AgentPoolImpl(AgentPoolInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.registryName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "registries"); + this.agentPoolName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "agentPools"); + } + + public AgentPool refresh() { + this.innerObject = serviceManager.serviceClient() + .getAgentPools() + .getWithResponse(resourceGroupName, registryName, agentPoolName, Context.NONE) + .getValue(); + return this; + } + + public AgentPool refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAgentPools() + .getWithResponse(resourceGroupName, registryName, agentPoolName, context) + .getValue(); + return this; + } + + public Response getQueueStatusWithResponse(Context context) { + return serviceManager.agentPools() + .getQueueStatusWithResponse(resourceGroupName, registryName, agentPoolName, context); + } + + public AgentPoolQueueStatus getQueueStatus() { + return serviceManager.agentPools().getQueueStatus(resourceGroupName, registryName, agentPoolName); + } + + public AgentPoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AgentPoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AgentPoolImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateUpdateParameters.withTags(tags); + return this; + } + } + + public AgentPoolImpl withProperties(AgentPoolProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public AgentPoolImpl withCount(Integer count) { + this.updateUpdateParameters.withCount(count); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolQueueStatusImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolQueueStatusImpl.java new file mode 100644 index 000000000000..a7557fc909fb --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolQueueStatusImpl.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolQueueStatus; + +public final class AgentPoolQueueStatusImpl implements AgentPoolQueueStatus { + private AgentPoolQueueStatusInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + AgentPoolQueueStatusImpl(AgentPoolQueueStatusInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer count() { + return this.innerModel().count(); + } + + public AgentPoolQueueStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsClientImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsClientImpl.java new file mode 100644 index 000000000000..6d937f9a70c7 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsClientImpl.java @@ -0,0 +1,1078 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.Post; +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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner; +import com.azure.resourcemanager.containerregistry.tasks.implementation.models.AgentPoolListResult; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolUpdateParameters; +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 AgentPoolsClient. + */ +public final class AgentPoolsClientImpl implements AgentPoolsClient { + /** + * The proxy service used to perform REST calls. + */ + private final AgentPoolsService service; + + /** + * The service client containing this operation class. + */ + private final ContainerRegistryTasksManagementClientImpl client; + + /** + * Initializes an instance of AgentPoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AgentPoolsClientImpl(ContainerRegistryTasksManagementClientImpl client) { + this.service + = RestProxy.create(AgentPoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerRegistryTasksManagementClientAgentPools to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContainerRegistryTasksManagementClientAgentPools") + public interface AgentPoolsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AgentPoolInner agentPool, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") AgentPoolInner agentPool, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") AgentPoolUpdateParameters updateParameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") AgentPoolUpdateParameters updateParameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getQueueStatus(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/agentPools/{agentPoolName}/listQueueStatus") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getQueueStatusSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("agentPoolName") String agentPoolName, @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String registryName, + String agentPoolName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String registryName, String agentPoolName) { + return getWithResponseAsync(resourceGroupName, registryName, agentPoolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String registryName, String agentPoolName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, registryName, agentPoolName, accept, context); + } + + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentPoolInner get(String resourceGroupName, String registryName, String agentPoolName) { + return getWithResponse(resourceGroupName, registryName, agentPoolName, Context.NONE).getValue(); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String registryName, + String agentPoolName, AgentPoolInner agentPool) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, contentType, accept, + agentPool, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolInner agentPool) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, contentType, accept, + agentPool, Context.NONE); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolInner agentPool, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, contentType, accept, + agentPool, context); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 {@link PollerFlux} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AgentPoolInner> beginCreateAsync(String resourceGroupName, + String registryName, String agentPoolName, AgentPoolInner agentPool) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, registryName, agentPoolName, agentPool); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + AgentPoolInner.class, AgentPoolInner.class, this.client.getContext()); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgentPoolInner> beginCreate(String resourceGroupName, + String registryName, String agentPoolName, AgentPoolInner agentPool) { + Response response = createWithResponse(resourceGroupName, registryName, agentPoolName, agentPool); + return this.client.getLroResult(response, AgentPoolInner.class, + AgentPoolInner.class, Context.NONE); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgentPoolInner> beginCreate(String resourceGroupName, + String registryName, String agentPoolName, AgentPoolInner agentPool, Context context) { + Response response + = createWithResponse(resourceGroupName, registryName, agentPoolName, agentPool, context); + return this.client.getLroResult(response, AgentPoolInner.class, + AgentPoolInner.class, context); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolInner agentPool) { + return beginCreateAsync(resourceGroupName, registryName, agentPoolName, agentPool).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentPoolInner create(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolInner agentPool) { + return beginCreate(resourceGroupName, registryName, agentPoolName, agentPool).getFinalResult(); + } + + /** + * Creates an agent pool for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param agentPool The parameters of an agent pool that needs to scheduled. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentPoolInner create(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolInner agentPool, Context context) { + return beginCreate(resourceGroupName, registryName, agentPoolName, agentPool, context).getFinalResult(); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String registryName, + String agentPoolName, AgentPoolUpdateParameters updateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, contentType, accept, + updateParameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, contentType, accept, + updateParameters, Context.NONE); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, contentType, accept, + updateParameters, context); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 {@link PollerFlux} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AgentPoolInner> beginUpdateAsync(String resourceGroupName, + String registryName, String agentPoolName, AgentPoolUpdateParameters updateParameters) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, registryName, agentPoolName, updateParameters); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + AgentPoolInner.class, AgentPoolInner.class, this.client.getContext()); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgentPoolInner> beginUpdate(String resourceGroupName, + String registryName, String agentPoolName, AgentPoolUpdateParameters updateParameters) { + Response response + = updateWithResponse(resourceGroupName, registryName, agentPoolName, updateParameters); + return this.client.getLroResult(response, AgentPoolInner.class, + AgentPoolInner.class, Context.NONE); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 {@link SyncPoller} for polling of the agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AgentPoolInner> beginUpdate(String resourceGroupName, + String registryName, String agentPoolName, AgentPoolUpdateParameters updateParameters, Context context) { + Response response + = updateWithResponse(resourceGroupName, registryName, agentPoolName, updateParameters, context); + return this.client.getLroResult(response, AgentPoolInner.class, + AgentPoolInner.class, context); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters) { + return beginUpdateAsync(resourceGroupName, registryName, agentPoolName, updateParameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentPoolInner update(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters) { + return beginUpdate(resourceGroupName, registryName, agentPoolName, updateParameters).getFinalResult(); + } + + /** + * Updates an agent pool with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @param updateParameters The parameters for updating an agent pool. + * @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 agentpool that has the ARM resource and properties. + * The agentpool will have all information to create an agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentPoolInner update(String resourceGroupName, String registryName, String agentPoolName, + AgentPoolUpdateParameters updateParameters, Context context) { + return beginUpdate(resourceGroupName, registryName, agentPoolName, updateParameters, context).getFinalResult(); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String registryName, + String agentPoolName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String registryName, + String agentPoolName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, Context.NONE); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String registryName, String agentPoolName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, context); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String registryName, + String agentPoolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, registryName, agentPoolName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String registryName, + String agentPoolName) { + Response response = deleteWithResponse(resourceGroupName, registryName, agentPoolName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String registryName, + String agentPoolName, Context context) { + Response response = deleteWithResponse(resourceGroupName, registryName, agentPoolName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String registryName, String agentPoolName) { + return beginDeleteAsync(resourceGroupName, registryName, agentPoolName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 registryName, String agentPoolName) { + beginDelete(resourceGroupName, registryName, agentPoolName).getFinalResult(); + } + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String registryName, String agentPoolName, Context context) { + beginDelete(resourceGroupName, registryName, agentPoolName, context).getFinalResult(); + } + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String registryName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, 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 agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String registryName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, registryName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName, + Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getQueueStatusWithResponseAsync(String resourceGroupName, + String registryName, String agentPoolName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getQueueStatus(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getQueueStatusAsync(String resourceGroupName, String registryName, + String agentPoolName) { + return getQueueStatusWithResponseAsync(resourceGroupName, registryName, agentPoolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getQueueStatusWithResponse(String resourceGroupName, String registryName, + String agentPoolName, Context context) { + final String accept = "application/json"; + return service.getQueueStatusSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, agentPoolName, accept, context); + } + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AgentPoolQueueStatusInner getQueueStatus(String resourceGroupName, String registryName, + String agentPoolName) { + return getQueueStatusWithResponse(resourceGroupName, registryName, agentPoolName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 collection of agent pools along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 URL to get the next list of items. + * @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 collection of agent pools along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 collection of agent pools along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsImpl.java new file mode 100644 index 000000000000..193cefc36cee --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.containerregistry.tasks.fluent.AgentPoolsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolQueueStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPools; + +public final class AgentPoolsImpl implements AgentPools { + private static final ClientLogger LOGGER = new ClientLogger(AgentPoolsImpl.class); + + private final AgentPoolsClient innerClient; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + public AgentPoolsImpl(AgentPoolsClient innerClient, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String registryName, String agentPoolName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, registryName, agentPoolName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AgentPoolImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AgentPool get(String resourceGroupName, String registryName, String agentPoolName) { + AgentPoolInner inner = this.serviceClient().get(resourceGroupName, registryName, agentPoolName); + if (inner != null) { + return new AgentPoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String registryName, String agentPoolName) { + this.serviceClient().delete(resourceGroupName, registryName, agentPoolName); + } + + public void delete(String resourceGroupName, String registryName, String agentPoolName, Context context) { + this.serviceClient().delete(resourceGroupName, registryName, agentPoolName, context); + } + + public PagedIterable list(String resourceGroupName, String registryName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AgentPoolImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String registryName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new AgentPoolImpl(inner1, this.manager())); + } + + public Response getQueueStatusWithResponse(String resourceGroupName, String registryName, + String agentPoolName, Context context) { + Response inner + = this.serviceClient().getQueueStatusWithResponse(resourceGroupName, registryName, agentPoolName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AgentPoolQueueStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AgentPoolQueueStatus getQueueStatus(String resourceGroupName, String registryName, String agentPoolName) { + AgentPoolQueueStatusInner inner + = this.serviceClient().getQueueStatus(resourceGroupName, registryName, agentPoolName); + if (inner != null) { + return new AgentPoolQueueStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public AgentPool getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String agentPoolName = ResourceManagerUtils.getValueFromIdByName(id, "agentPools"); + if (agentPoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agentPools'.", id))); + } + return this.getWithResponse(resourceGroupName, registryName, agentPoolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String agentPoolName = ResourceManagerUtils.getValueFromIdByName(id, "agentPools"); + if (agentPoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agentPools'.", id))); + } + return this.getWithResponse(resourceGroupName, registryName, agentPoolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String agentPoolName = ResourceManagerUtils.getValueFromIdByName(id, "agentPools"); + if (agentPoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agentPools'.", id))); + } + this.delete(resourceGroupName, registryName, agentPoolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String agentPoolName = ResourceManagerUtils.getValueFromIdByName(id, "agentPools"); + if (agentPoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'agentPools'.", id))); + } + this.delete(resourceGroupName, registryName, agentPoolName, context); + } + + private AgentPoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } + + public AgentPoolImpl define(String name) { + return new AgentPoolImpl(name, this.manager()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientBuilder.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientBuilder.java new file mode 100644 index 000000000000..3e343829f27f --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientBuilder.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.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 ContainerRegistryTasksManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { ContainerRegistryTasksManagementClientImpl.class }) +public final class ContainerRegistryTasksManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the ContainerRegistryTasksManagementClientBuilder. + */ + public ContainerRegistryTasksManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the ContainerRegistryTasksManagementClientBuilder. + */ + public ContainerRegistryTasksManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ContainerRegistryTasksManagementClientBuilder. + */ + public ContainerRegistryTasksManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 ContainerRegistryTasksManagementClientBuilder. + */ + public ContainerRegistryTasksManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 ContainerRegistryTasksManagementClientBuilder. + */ + public ContainerRegistryTasksManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 ContainerRegistryTasksManagementClientBuilder. + */ + public ContainerRegistryTasksManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ContainerRegistryTasksManagementClientImpl with the provided parameters. + * + * @return an instance of ContainerRegistryTasksManagementClientImpl. + */ + public ContainerRegistryTasksManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + ContainerRegistryTasksManagementClientImpl client + = new ContainerRegistryTasksManagementClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientImpl.java new file mode 100644 index 000000000000..a4931d765bc5 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +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.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.ContainerRegistryTasksManagementClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the ContainerRegistryTasksManagementClientImpl type. + */ +@ServiceClient(builder = ContainerRegistryTasksManagementClientBuilder.class) +public final class ContainerRegistryTasksManagementClientImpl implements ContainerRegistryTasksManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * 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 AgentPoolsClient object to access its operations. + */ + private final AgentPoolsClient agentPools; + + /** + * Gets the AgentPoolsClient object to access its operations. + * + * @return the AgentPoolsClient object. + */ + public AgentPoolsClient getAgentPools() { + return this.agentPools; + } + + /** + * The RunsClient object to access its operations. + */ + private final RunsClient runs; + + /** + * Gets the RunsClient object to access its operations. + * + * @return the RunsClient object. + */ + public RunsClient getRuns() { + return this.runs; + } + + /** + * The TaskRunsClient object to access its operations. + */ + private final TaskRunsClient taskRuns; + + /** + * Gets the TaskRunsClient object to access its operations. + * + * @return the TaskRunsClient object. + */ + public TaskRunsClient getTaskRuns() { + return this.taskRuns; + } + + /** + * The TasksClient object to access its operations. + */ + private final TasksClient tasks; + + /** + * Gets the TasksClient object to access its operations. + * + * @return the TasksClient object. + */ + public TasksClient getTasks() { + return this.tasks; + } + + /** + * The RegistriesClient object to access its operations. + */ + private final RegistriesClient registries; + + /** + * Gets the RegistriesClient object to access its operations. + * + * @return the RegistriesClient object. + */ + public RegistriesClient getRegistries() { + return this.registries; + } + + /** + * Initializes an instance of ContainerRegistryTasksManagementClient 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 endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + ContainerRegistryTasksManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-03-01-preview"; + this.agentPools = new AgentPoolsClientImpl(this); + this.runs = new RunsClientImpl(this); + this.taskRuns = new TaskRunsClientImpl(this); + this.tasks = new TasksClientImpl(this); + this.registries = new RegistriesClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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 long running operation result. + * + * @param activationResponse the response of activation operation. + * @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 SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.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(HttpHeaderName.fromString(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryTasksManagementClientImpl.class); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesClientImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesClientImpl.java new file mode 100644 index 000000000000..7c48469cdf01 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesClientImpl.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.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.resourcemanager.containerregistry.tasks.fluent.RegistriesClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RegistriesClient. + */ +public final class RegistriesClientImpl implements RegistriesClient { + /** + * The proxy service used to perform REST calls. + */ + private final RegistriesService service; + + /** + * The service client containing this operation class. + */ + private final ContainerRegistryTasksManagementClientImpl client; + + /** + * Initializes an instance of RegistriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RegistriesClientImpl(ContainerRegistryTasksManagementClientImpl client) { + this.service + = RestProxy.create(RegistriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerRegistryTasksManagementClientRegistries to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContainerRegistryTasksManagementClientRegistries") + public interface RegistriesService { + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> scheduleRun(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RunRequest runRequest, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/scheduleRun") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response scheduleRunSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") RunRequest runRequest, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getBuildSourceUploadUrl(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/listBuildSourceUploadUrl") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getBuildSourceUploadUrlSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> scheduleRunWithResponseAsync(String resourceGroupName, String registryName, + RunRequest runRequest) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.scheduleRun(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, contentType, accept, runRequest, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono scheduleRunAsync(String resourceGroupName, String registryName, RunRequest runRequest) { + return scheduleRunWithResponseAsync(resourceGroupName, registryName, runRequest) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response scheduleRunWithResponse(String resourceGroupName, String registryName, + RunRequest runRequest, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.scheduleRunSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, contentType, accept, runRequest, context); + } + + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RunInner scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest) { + return scheduleRunWithResponse(resourceGroupName, registryName, runRequest, Context.NONE).getValue(); + } + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getBuildSourceUploadUrlWithResponseAsync(String resourceGroupName, String registryName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.getBuildSourceUploadUrl(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getBuildSourceUploadUrlAsync(String resourceGroupName, + String registryName) { + return getBuildSourceUploadUrlWithResponseAsync(resourceGroupName, registryName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getBuildSourceUploadUrlWithResponse(String resourceGroupName, + String registryName, Context context) { + final String accept = "application/json"; + return service.getBuildSourceUploadUrlSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, context); + } + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SourceUploadDefinitionInner getBuildSourceUploadUrl(String resourceGroupName, String registryName) { + return getBuildSourceUploadUrlWithResponse(resourceGroupName, registryName, Context.NONE).getValue(); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesImpl.java new file mode 100644 index 000000000000..cc4a6a5326e5 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesImpl.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +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.containerregistry.tasks.fluent.RegistriesClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner; +import com.azure.resourcemanager.containerregistry.tasks.models.Registries; +import com.azure.resourcemanager.containerregistry.tasks.models.Run; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceUploadDefinition; + +public final class RegistriesImpl implements Registries { + private static final ClientLogger LOGGER = new ClientLogger(RegistriesImpl.class); + + private final RegistriesClient innerClient; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + public RegistriesImpl(RegistriesClient innerClient, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response scheduleRunWithResponse(String resourceGroupName, String registryName, RunRequest runRequest, + Context context) { + Response inner + = this.serviceClient().scheduleRunWithResponse(resourceGroupName, registryName, runRequest, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Run scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest) { + RunInner inner = this.serviceClient().scheduleRun(resourceGroupName, registryName, runRequest); + if (inner != null) { + return new RunImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getBuildSourceUploadUrlWithResponse(String resourceGroupName, + String registryName, Context context) { + Response inner + = this.serviceClient().getBuildSourceUploadUrlWithResponse(resourceGroupName, registryName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SourceUploadDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public SourceUploadDefinition getBuildSourceUploadUrl(String resourceGroupName, String registryName) { + SourceUploadDefinitionInner inner + = this.serviceClient().getBuildSourceUploadUrl(resourceGroupName, registryName); + if (inner != null) { + return new SourceUploadDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + private RegistriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ResourceManagerUtils.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..10cd61dc1a63 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunGetLogResultImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunGetLogResultImpl.java new file mode 100644 index 000000000000..0a692805fe58 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunGetLogResultImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner; +import com.azure.resourcemanager.containerregistry.tasks.models.RunGetLogResult; + +public final class RunGetLogResultImpl implements RunGetLogResult { + private RunGetLogResultInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + RunGetLogResultImpl(RunGetLogResultInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String logLink() { + return this.innerModel().logLink(); + } + + public String logArtifactLink() { + return this.innerModel().logArtifactLink(); + } + + public RunGetLogResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunImpl.java new file mode 100644 index 000000000000..99e84f8610ed --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.models.Run; +import com.azure.resourcemanager.containerregistry.tasks.models.RunProperties; + +public final class RunImpl implements Run { + private RunInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + RunImpl(RunInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public RunProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public RunInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsClientImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsClientImpl.java new file mode 100644 index 000000000000..25b73fa2b64c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsClientImpl.java @@ -0,0 +1,679 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +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.resourcemanager.containerregistry.tasks.fluent.RunsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.implementation.models.RunListResult; +import com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in RunsClient. + */ +public final class RunsClientImpl implements RunsClient { + /** + * The proxy service used to perform REST calls. + */ + private final RunsService service; + + /** + * The service client containing this operation class. + */ + private final ContainerRegistryTasksManagementClientImpl client; + + /** + * Initializes an instance of RunsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RunsClientImpl(ContainerRegistryTasksManagementClientImpl client) { + this.service = RestProxy.create(RunsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerRegistryTasksManagementClientRuns to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContainerRegistryTasksManagementClientRuns") + public interface RunsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, @HeaderParam("Accept") String accept, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") RunUpdateParameters runUpdateParameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") RunUpdateParameters runUpdateParameters, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @QueryParam("$filter") String filter, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @QueryParam("$filter") String filter, @QueryParam("$top") Integer top, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getLogSasUrl(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/listLogSasUrl") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getLogSasUrlSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> cancel(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/runs/{runId}/cancel") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response cancelSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("runId") String runId, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 detailed information for a given run along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String registryName, String runId) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 detailed information for a given run on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String registryName, String runId) { + return getWithResponseAsync(resourceGroupName, registryName, runId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 detailed information for a given run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String registryName, String runId, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, registryName, runId, accept, context); + } + + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 detailed information for a given run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RunInner get(String resourceGroupName, String registryName, String runId) { + return getWithResponse(resourceGroupName, registryName, runId, Context.NONE).getValue(); + } + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String registryName, + String runId, RunUpdateParameters runUpdateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, contentType, accept, + runUpdateParameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters) { + return updateWithResponseAsync(resourceGroupName, registryName, runId, runUpdateParameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, contentType, accept, + runUpdateParameters, context); + } + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RunInner update(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters) { + return updateWithResponse(resourceGroupName, registryName, runId, runUpdateParameters, Context.NONE).getValue(); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String registryName, + String filter, Integer top) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, filter, top, 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())); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String registryName, String filter, Integer top) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, registryName, filter, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 all the runs for a registry as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String registryName) { + final String filter = null; + final Integer top = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, registryName, filter, top), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName, String filter, + Integer top) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, filter, top, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName, String filter, + Integer top, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, filter, top, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 all the runs for a registry as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName) { + final String filter = null; + final Integer top = null; + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName, filter, top), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName, String filter, Integer top, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName, filter, top, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 a link to download the run logs along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getLogSasUrlWithResponseAsync(String resourceGroupName, + String registryName, String runId) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getLogSasUrl(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 a link to download the run logs on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getLogSasUrlAsync(String resourceGroupName, String registryName, String runId) { + return getLogSasUrlWithResponseAsync(resourceGroupName, registryName, runId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 a link to download the run logs along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getLogSasUrlWithResponse(String resourceGroupName, String registryName, + String runId, Context context) { + final String accept = "application/json"; + return service.getLogSasUrlSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, accept, context); + } + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 a link to download the run logs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RunGetLogResultInner getLogSasUrl(String resourceGroupName, String registryName, String runId) { + return getLogSasUrlWithResponse(resourceGroupName, registryName, runId, Context.NONE).getValue(); + } + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> cancelWithResponseAsync(String resourceGroupName, String registryName, String runId) { + return FluxUtil + .withContext(context -> service.cancel(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String registryName, String runId) { + return cancelWithResponseAsync(resourceGroupName, registryName, runId).flatMap(ignored -> Mono.empty()); + } + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response cancelWithResponse(String resourceGroupName, String registryName, String runId, + Context context) { + return service.cancelSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, runId, context); + } + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @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 cancel(String resourceGroupName, String registryName, String runId) { + cancelWithResponse(resourceGroupName, registryName, runId, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 all the runs for a registry along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 URL to get the next list of items. + * @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 all the runs for a registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 all the runs for a registry along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsImpl.java new file mode 100644 index 000000000000..8849d9c9334b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsImpl.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.containerregistry.tasks.fluent.RunsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.models.Run; +import com.azure.resourcemanager.containerregistry.tasks.models.RunGetLogResult; +import com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Runs; + +public final class RunsImpl implements Runs { + private static final ClientLogger LOGGER = new ClientLogger(RunsImpl.class); + + private final RunsClient innerClient; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + public RunsImpl(RunsClient innerClient, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String registryName, String runId, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, registryName, runId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Run get(String resourceGroupName, String registryName, String runId) { + RunInner inner = this.serviceClient().get(resourceGroupName, registryName, runId); + if (inner != null) { + return new RunImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters, Context context) { + Response inner = this.serviceClient() + .updateWithResponse(resourceGroupName, registryName, runId, runUpdateParameters, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Run update(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters) { + RunInner inner = this.serviceClient().update(resourceGroupName, registryName, runId, runUpdateParameters); + if (inner != null) { + return new RunImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceGroupName, String registryName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RunImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String registryName, String filter, Integer top, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, registryName, filter, top, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new RunImpl(inner1, this.manager())); + } + + public Response getLogSasUrlWithResponse(String resourceGroupName, String registryName, + String runId, Context context) { + Response inner + = this.serviceClient().getLogSasUrlWithResponse(resourceGroupName, registryName, runId, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RunGetLogResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public RunGetLogResult getLogSasUrl(String resourceGroupName, String registryName, String runId) { + RunGetLogResultInner inner = this.serviceClient().getLogSasUrl(resourceGroupName, registryName, runId); + if (inner != null) { + return new RunGetLogResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response cancelWithResponse(String resourceGroupName, String registryName, String runId, + Context context) { + return this.serviceClient().cancelWithResponse(resourceGroupName, registryName, runId, context); + } + + public void cancel(String resourceGroupName, String registryName, String runId) { + this.serviceClient().cancel(resourceGroupName, registryName, runId); + } + + private RunsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/SourceUploadDefinitionImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/SourceUploadDefinitionImpl.java new file mode 100644 index 000000000000..486b0dc09a55 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/SourceUploadDefinitionImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceUploadDefinition; + +public final class SourceUploadDefinitionImpl implements SourceUploadDefinition { + private SourceUploadDefinitionInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + SourceUploadDefinitionImpl(SourceUploadDefinitionInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String uploadUrl() { + return this.innerModel().uploadUrl(); + } + + public String relativePath() { + return this.innerModel().relativePath(); + } + + public SourceUploadDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskImpl.java new file mode 100644 index 000000000000..6e29682b4ee5 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskImpl.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Task; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStepUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerUpdateParameters; +import java.util.Collections; +import java.util.Map; + +public final class TaskImpl implements Task, Task.Definition, Task.Update { + private TaskInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager 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 TaskProperties properties() { + return this.innerModel().properties(); + } + + public IdentityProperties identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TaskInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String registryName; + + private String taskName; + + private TaskUpdateParameters updateTaskUpdateParameters; + + public TaskImpl withExistingRegistry(String resourceGroupName, String registryName) { + this.resourceGroupName = resourceGroupName; + this.registryName = registryName; + return this; + } + + public Task create() { + this.innerObject = serviceManager.serviceClient() + .getTasks() + .createWithResponse(resourceGroupName, registryName, taskName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public Task create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTasks() + .createWithResponse(resourceGroupName, registryName, taskName, this.innerModel(), context) + .getValue(); + return this; + } + + TaskImpl(String name, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = new TaskInner(); + this.serviceManager = serviceManager; + this.taskName = name; + } + + public TaskImpl update() { + this.updateTaskUpdateParameters = new TaskUpdateParameters(); + return this; + } + + public Task apply() { + this.innerObject = serviceManager.serviceClient() + .getTasks() + .updateWithResponse(resourceGroupName, registryName, taskName, updateTaskUpdateParameters, Context.NONE) + .getValue(); + return this; + } + + public Task apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTasks() + .updateWithResponse(resourceGroupName, registryName, taskName, updateTaskUpdateParameters, context) + .getValue(); + return this; + } + + TaskImpl(TaskInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.registryName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "registries"); + this.taskName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "tasks"); + } + + public Task refresh() { + this.innerObject = serviceManager.serviceClient() + .getTasks() + .getWithResponse(resourceGroupName, registryName, taskName, Context.NONE) + .getValue(); + return this; + } + + public Task refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTasks() + .getWithResponse(resourceGroupName, registryName, taskName, context) + .getValue(); + return this; + } + + public Response getDetailsWithResponse(Context context) { + return serviceManager.tasks().getDetailsWithResponse(resourceGroupName, registryName, taskName, context); + } + + public Task getDetails() { + return serviceManager.tasks().getDetails(resourceGroupName, registryName, taskName); + } + + public TaskImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TaskImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TaskImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateTaskUpdateParameters.withTags(tags); + return this; + } + } + + public TaskImpl withProperties(TaskProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public TaskImpl withIdentity(IdentityProperties identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateTaskUpdateParameters.withIdentity(identity); + return this; + } + } + + public TaskImpl withStatus(TaskStatus status) { + this.updateTaskUpdateParameters.withStatus(status); + return this; + } + + public TaskImpl withPlatform(PlatformUpdateParameters platform) { + this.updateTaskUpdateParameters.withPlatform(platform); + return this; + } + + public TaskImpl withAgentConfiguration(AgentProperties agentConfiguration) { + this.updateTaskUpdateParameters.withAgentConfiguration(agentConfiguration); + return this; + } + + public TaskImpl withAgentPoolName(String agentPoolName) { + this.updateTaskUpdateParameters.withAgentPoolName(agentPoolName); + return this; + } + + public TaskImpl withTimeout(Integer timeout) { + this.updateTaskUpdateParameters.withTimeout(timeout); + return this; + } + + public TaskImpl withStep(TaskStepUpdateParameters step) { + this.updateTaskUpdateParameters.withStep(step); + return this; + } + + public TaskImpl withTrigger(TriggerUpdateParameters trigger) { + this.updateTaskUpdateParameters.withTrigger(trigger); + return this; + } + + public TaskImpl withCredentials(Credentials credentials) { + this.updateTaskUpdateParameters.withCredentials(credentials); + return this; + } + + public TaskImpl withLogTemplate(String logTemplate) { + this.updateTaskUpdateParameters.withLogTemplate(logTemplate); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunImpl.java new file mode 100644 index 000000000000..5d2b24162732 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRun; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunUpdateParameters; +import java.util.Map; + +public final class TaskRunImpl implements TaskRun, TaskRun.Definition, TaskRun.Update { + private TaskRunInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public TaskRunProperties properties() { + TaskRunPropertiesInner inner = this.innerModel().properties(); + if (inner != null) { + return new TaskRunPropertiesImpl(inner, this.manager()); + } else { + return null; + } + } + + public IdentityProperties identity() { + return this.innerModel().identity(); + } + + public String location() { + return this.innerModel().location(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TaskRunInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String registryName; + + private String taskRunName; + + private TaskRunUpdateParameters updateUpdateParameters; + + public TaskRunImpl withExistingRegistry(String resourceGroupName, String registryName) { + this.resourceGroupName = resourceGroupName; + this.registryName = registryName; + return this; + } + + public TaskRun create() { + this.innerObject = serviceManager.serviceClient() + .getTaskRuns() + .create(resourceGroupName, registryName, taskRunName, this.innerModel(), Context.NONE); + return this; + } + + public TaskRun create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTaskRuns() + .create(resourceGroupName, registryName, taskRunName, this.innerModel(), context); + return this; + } + + TaskRunImpl(String name, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = new TaskRunInner(); + this.serviceManager = serviceManager; + this.taskRunName = name; + } + + public TaskRunImpl update() { + this.updateUpdateParameters = new TaskRunUpdateParameters(); + return this; + } + + public TaskRun apply() { + this.innerObject = serviceManager.serviceClient() + .getTaskRuns() + .update(resourceGroupName, registryName, taskRunName, updateUpdateParameters, Context.NONE); + return this; + } + + public TaskRun apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTaskRuns() + .update(resourceGroupName, registryName, taskRunName, updateUpdateParameters, context); + return this; + } + + TaskRunImpl(TaskRunInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.registryName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "registries"); + this.taskRunName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "taskRuns"); + } + + public TaskRun refresh() { + this.innerObject = serviceManager.serviceClient() + .getTaskRuns() + .getWithResponse(resourceGroupName, registryName, taskRunName, Context.NONE) + .getValue(); + return this; + } + + public TaskRun refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTaskRuns() + .getWithResponse(resourceGroupName, registryName, taskRunName, context) + .getValue(); + return this; + } + + public Response getDetailsWithResponse(Context context) { + return serviceManager.taskRuns().getDetailsWithResponse(resourceGroupName, registryName, taskRunName, context); + } + + public TaskRun getDetails() { + return serviceManager.taskRuns().getDetails(resourceGroupName, registryName, taskRunName); + } + + public TaskRunImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TaskRunImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TaskRunImpl withProperties(TaskRunPropertiesInner properties) { + this.innerModel().withProperties(properties); + return this; + } + + public TaskRunImpl withIdentity(IdentityProperties identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateUpdateParameters.withIdentity(identity); + return this; + } + } + + public TaskRunImpl withTags(Map tags) { + this.updateUpdateParameters.withTags(tags); + return this; + } + + public TaskRunImpl withRunRequest(RunRequest runRequest) { + this.updateUpdateParameters.withRunRequest(runRequest); + return this; + } + + public TaskRunImpl withForceUpdateTag(String forceUpdateTag) { + this.updateUpdateParameters.withForceUpdateTag(forceUpdateTag); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel() == null || this.innerModel().id() == null; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunPropertiesImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunPropertiesImpl.java new file mode 100644 index 000000000000..cdcf9e7fbaf6 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunPropertiesImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner; +import com.azure.resourcemanager.containerregistry.tasks.models.ProvisioningState; +import com.azure.resourcemanager.containerregistry.tasks.models.Run; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunProperties; + +public final class TaskRunPropertiesImpl implements TaskRunProperties { + private TaskRunPropertiesInner innerObject; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + TaskRunPropertiesImpl(TaskRunPropertiesInner innerObject, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public RunRequest runRequest() { + return this.innerModel().runRequest(); + } + + public Run runResult() { + RunInner inner = this.innerModel().runResult(); + if (inner != null) { + return new RunImpl(inner, this.manager()); + } else { + return null; + } + } + + public String forceUpdateTag() { + return this.innerModel().forceUpdateTag(); + } + + public TaskRunPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsClientImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsClientImpl.java new file mode 100644 index 000000000000..4bc85d5bdb59 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsClientImpl.java @@ -0,0 +1,981 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.Post; +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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner; +import com.azure.resourcemanager.containerregistry.tasks.implementation.models.TaskRunListResult; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunUpdateParameters; +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 TaskRunsClient. + */ +public final class TaskRunsClientImpl implements TaskRunsClient { + /** + * The proxy service used to perform REST calls. + */ + private final TaskRunsService service; + + /** + * The service client containing this operation class. + */ + private final ContainerRegistryTasksManagementClientImpl client; + + /** + * Initializes an instance of TaskRunsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TaskRunsClientImpl(ContainerRegistryTasksManagementClientImpl client) { + this.service = RestProxy.create(TaskRunsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerRegistryTasksManagementClientTaskRuns to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContainerRegistryTasksManagementClientTaskRuns") + public interface TaskRunsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TaskRunInner taskRun, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TaskRunInner taskRun, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") TaskRunUpdateParameters updateParameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") TaskRunUpdateParameters updateParameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDetails(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/taskRuns/{taskRunName}/listDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getDetailsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskRunName") String taskRunName, @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String registryName, + String taskRunName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String registryName, String taskRunName) { + return getWithResponseAsync(resourceGroupName, registryName, taskRunName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, registryName, taskRunName, accept, context); + } + + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskRunInner get(String resourceGroupName, String registryName, String taskRunName) { + return getWithResponse(resourceGroupName, registryName, taskRunName, Context.NONE).getValue(); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync(String resourceGroupName, String registryName, + String taskRunName, TaskRunInner taskRun) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, contentType, accept, + taskRun, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String registryName, String taskRunName, + TaskRunInner taskRun) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, contentType, accept, taskRun, + Context.NONE); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createWithResponse(String resourceGroupName, String registryName, String taskRunName, + TaskRunInner taskRun, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, contentType, accept, taskRun, + context); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 {@link PollerFlux} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TaskRunInner> beginCreateAsync(String resourceGroupName, + String registryName, String taskRunName, TaskRunInner taskRun) { + Mono>> mono + = createWithResponseAsync(resourceGroupName, registryName, taskRunName, taskRun); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + TaskRunInner.class, TaskRunInner.class, this.client.getContext()); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TaskRunInner> beginCreate(String resourceGroupName, String registryName, + String taskRunName, TaskRunInner taskRun) { + Response response = createWithResponse(resourceGroupName, registryName, taskRunName, taskRun); + return this.client.getLroResult(response, TaskRunInner.class, TaskRunInner.class, + Context.NONE); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TaskRunInner> beginCreate(String resourceGroupName, String registryName, + String taskRunName, TaskRunInner taskRun, Context context) { + Response response + = createWithResponse(resourceGroupName, registryName, taskRunName, taskRun, context); + return this.client.getLroResult(response, TaskRunInner.class, TaskRunInner.class, + context); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String registryName, String taskRunName, + TaskRunInner taskRun) { + return beginCreateAsync(resourceGroupName, registryName, taskRunName, taskRun).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskRunInner create(String resourceGroupName, String registryName, String taskRunName, + TaskRunInner taskRun) { + return beginCreate(resourceGroupName, registryName, taskRunName, taskRun).getFinalResult(); + } + + /** + * Creates a task run for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param taskRun The parameters of a run that needs to scheduled. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskRunInner create(String resourceGroupName, String registryName, String taskRunName, TaskRunInner taskRun, + Context context) { + return beginCreate(resourceGroupName, registryName, taskRunName, taskRun, context).getFinalResult(); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String registryName, + String taskRunName, TaskRunUpdateParameters updateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, contentType, accept, + updateParameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, contentType, accept, + updateParameters, Context.NONE); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, contentType, accept, + updateParameters, context); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 {@link PollerFlux} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TaskRunInner> beginUpdateAsync(String resourceGroupName, + String registryName, String taskRunName, TaskRunUpdateParameters updateParameters) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, registryName, taskRunName, updateParameters); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + TaskRunInner.class, TaskRunInner.class, this.client.getContext()); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TaskRunInner> beginUpdate(String resourceGroupName, String registryName, + String taskRunName, TaskRunUpdateParameters updateParameters) { + Response response + = updateWithResponse(resourceGroupName, registryName, taskRunName, updateParameters); + return this.client.getLroResult(response, TaskRunInner.class, TaskRunInner.class, + Context.NONE); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 {@link SyncPoller} for polling of the task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TaskRunInner> beginUpdate(String resourceGroupName, String registryName, + String taskRunName, TaskRunUpdateParameters updateParameters, Context context) { + Response response + = updateWithResponse(resourceGroupName, registryName, taskRunName, updateParameters, context); + return this.client.getLroResult(response, TaskRunInner.class, TaskRunInner.class, + context); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters) { + return beginUpdateAsync(resourceGroupName, registryName, taskRunName, updateParameters).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskRunInner update(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters) { + return beginUpdate(resourceGroupName, registryName, taskRunName, updateParameters).getFinalResult(); + } + + /** + * Updates a task run with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @param updateParameters The parameters for updating a task run. + * @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 task run that has the ARM resource and properties. + * The task run will have the information of request and result of a run. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskRunInner update(String resourceGroupName, String registryName, String taskRunName, + TaskRunUpdateParameters updateParameters, Context context) { + return beginUpdate(resourceGroupName, registryName, taskRunName, updateParameters, context).getFinalResult(); + } + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String registryName, + String taskRunName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String registryName, String taskRunName) { + return deleteWithResponseAsync(resourceGroupName, registryName, taskRunName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, context); + } + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 registryName, String taskRunName) { + deleteWithResponse(resourceGroupName, registryName, taskRunName, Context.NONE); + } + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String registryName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, 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 task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String registryName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, registryName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDetailsWithResponseAsync(String resourceGroupName, String registryName, + String taskRunName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDetails(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDetailsAsync(String resourceGroupName, String registryName, String taskRunName) { + return getDetailsWithResponseAsync(resourceGroupName, registryName, taskRunName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDetailsWithResponse(String resourceGroupName, String registryName, + String taskRunName, Context context) { + final String accept = "application/json"; + return service.getDetailsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskRunName, accept, context); + } + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskRunInner getDetails(String resourceGroupName, String registryName, String taskRunName) { + return getDetailsWithResponse(resourceGroupName, registryName, taskRunName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 collection of task runs along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 URL to get the next list of items. + * @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 collection of task runs along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 collection of task runs along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsImpl.java new file mode 100644 index 000000000000..d0449c3b08d4 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.containerregistry.tasks.fluent.TaskRunsClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRun; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRuns; + +public final class TaskRunsImpl implements TaskRuns { + private static final ClientLogger LOGGER = new ClientLogger(TaskRunsImpl.class); + + private final TaskRunsClient innerClient; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + public TaskRunsImpl(TaskRunsClient innerClient, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, registryName, taskRunName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TaskRunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TaskRun get(String resourceGroupName, String registryName, String taskRunName) { + TaskRunInner inner = this.serviceClient().get(resourceGroupName, registryName, taskRunName); + if (inner != null) { + return new TaskRunImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, registryName, taskRunName, context); + } + + public void delete(String resourceGroupName, String registryName, String taskRunName) { + this.serviceClient().delete(resourceGroupName, registryName, taskRunName); + } + + public PagedIterable list(String resourceGroupName, String registryName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TaskRunImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String registryName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TaskRunImpl(inner1, this.manager())); + } + + public Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context) { + Response inner + = this.serviceClient().getDetailsWithResponse(resourceGroupName, registryName, taskRunName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TaskRunImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TaskRun getDetails(String resourceGroupName, String registryName, String taskRunName) { + TaskRunInner inner = this.serviceClient().getDetails(resourceGroupName, registryName, taskRunName); + if (inner != null) { + return new TaskRunImpl(inner, this.manager()); + } else { + return null; + } + } + + public TaskRun getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskRunName = ResourceManagerUtils.getValueFromIdByName(id, "taskRuns"); + if (taskRunName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'taskRuns'.", id))); + } + return this.getWithResponse(resourceGroupName, registryName, taskRunName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskRunName = ResourceManagerUtils.getValueFromIdByName(id, "taskRuns"); + if (taskRunName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'taskRuns'.", id))); + } + return this.getWithResponse(resourceGroupName, registryName, taskRunName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskRunName = ResourceManagerUtils.getValueFromIdByName(id, "taskRuns"); + if (taskRunName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'taskRuns'.", id))); + } + this.deleteWithResponse(resourceGroupName, registryName, taskRunName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskRunName = ResourceManagerUtils.getValueFromIdByName(id, "taskRuns"); + if (taskRunName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'taskRuns'.", id))); + } + return this.deleteWithResponse(resourceGroupName, registryName, taskRunName, context); + } + + private TaskRunsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } + + public TaskRunImpl define(String name) { + return new TaskRunImpl(name, this.manager()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksClientImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksClientImpl.java new file mode 100644 index 000000000000..759a8a5e22dd --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksClientImpl.java @@ -0,0 +1,761 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.Post; +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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner; +import com.azure.resourcemanager.containerregistry.tasks.implementation.models.TaskListResult; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskUpdateParameters; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TasksClient. + */ +public final class TasksClientImpl implements TasksClient { + /** + * The proxy service used to perform REST calls. + */ + private final TasksService service; + + /** + * The service client containing this operation class. + */ + private final ContainerRegistryTasksManagementClientImpl client; + + /** + * Initializes an instance of TasksClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TasksClientImpl(ContainerRegistryTasksManagementClientImpl client) { + this.service = RestProxy.create(TasksService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerRegistryTasksManagementClientTasks to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "ContainerRegistryTasksManagementClientTasks") + public interface TasksService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TaskInner taskCreateParameters, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") TaskInner taskCreateParameters, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") TaskUpdateParameters taskUpdateParameters, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") TaskUpdateParameters taskUpdateParameters, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDetails(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/tasks/{taskName}/listDetails") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getDetailsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("registryName") String registryName, + @PathParam("taskName") String taskName, @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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String registryName, + String taskName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String registryName, String taskName) { + return getWithResponseAsync(resourceGroupName, registryName, taskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String registryName, String taskName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, registryName, taskName, accept, context); + } + + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskInner get(String resourceGroupName, String registryName, String taskName) { + return getWithResponse(resourceGroupName, registryName, taskName, Context.NONE).getValue(); + } + + /** + * Creates a task for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskCreateParameters The parameters for creating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, String registryName, + String taskName, TaskInner taskCreateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, contentType, accept, + taskCreateParameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a task for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskCreateParameters The parameters for creating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String registryName, String taskName, + TaskInner taskCreateParameters) { + return createWithResponseAsync(resourceGroupName, registryName, taskName, taskCreateParameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates a task for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskCreateParameters The parameters for creating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String registryName, String taskName, + TaskInner taskCreateParameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, contentType, accept, + taskCreateParameters, context); + } + + /** + * Creates a task for a container registry with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskCreateParameters The parameters for creating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskInner create(String resourceGroupName, String registryName, String taskName, + TaskInner taskCreateParameters) { + return createWithResponse(resourceGroupName, registryName, taskName, taskCreateParameters, Context.NONE) + .getValue(); + } + + /** + * Updates a task with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskUpdateParameters The parameters for updating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, String registryName, + String taskName, TaskUpdateParameters taskUpdateParameters) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, contentType, accept, + taskUpdateParameters, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates a task with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskUpdateParameters The parameters for updating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String registryName, String taskName, + TaskUpdateParameters taskUpdateParameters) { + return updateWithResponseAsync(resourceGroupName, registryName, taskName, taskUpdateParameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates a task with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskUpdateParameters The parameters for updating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String registryName, String taskName, + TaskUpdateParameters taskUpdateParameters, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, contentType, accept, + taskUpdateParameters, context); + } + + /** + * Updates a task with the specified parameters. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @param taskUpdateParameters The parameters for updating a task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskInner update(String resourceGroupName, String registryName, String taskName, + TaskUpdateParameters taskUpdateParameters) { + return updateWithResponse(resourceGroupName, registryName, taskName, taskUpdateParameters, Context.NONE) + .getValue(); + } + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String registryName, + String taskName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String registryName, String taskName) { + return deleteWithResponseAsync(resourceGroupName, registryName, taskName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String registryName, String taskName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, context); + } + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 registryName, String taskName) { + deleteWithResponse(resourceGroupName, registryName, taskName, Context.NONE); + } + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String registryName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, 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 tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String registryName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, registryName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String registryName, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String registryName, Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, registryName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDetailsWithResponseAsync(String resourceGroupName, String registryName, + String taskName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDetails(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDetailsAsync(String resourceGroupName, String registryName, String taskName) { + return getDetailsWithResponseAsync(resourceGroupName, registryName, taskName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskName, + Context context) { + final String accept = "application/json"; + return service.getDetailsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, registryName, taskName, accept, context); + } + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TaskInner getDetails(String resourceGroupName, String registryName, String taskName) { + return getDetailsWithResponse(resourceGroupName, registryName, taskName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 collection of tasks along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + 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 URL to get the next list of items. + * @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 collection of tasks along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 collection of tasks along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksImpl.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksImpl.java new file mode 100644 index 000000000000..25c8af8889e8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksImpl.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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.containerregistry.tasks.fluent.TasksClient; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner; +import com.azure.resourcemanager.containerregistry.tasks.models.Task; +import com.azure.resourcemanager.containerregistry.tasks.models.Tasks; + +public final class TasksImpl implements Tasks { + private static final ClientLogger LOGGER = new ClientLogger(TasksImpl.class); + + private final TasksClient innerClient; + + private final com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager; + + public TasksImpl(TasksClient innerClient, + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String registryName, String taskName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, registryName, taskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Task get(String resourceGroupName, String registryName, String taskName) { + TaskInner inner = this.serviceClient().get(resourceGroupName, registryName, taskName); + if (inner != null) { + return new TaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String registryName, String taskName, + Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, registryName, taskName, context); + } + + public void delete(String resourceGroupName, String registryName, String taskName) { + this.serviceClient().delete(resourceGroupName, registryName, taskName); + } + + public PagedIterable list(String resourceGroupName, String registryName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TaskImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String registryName, Context context) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, registryName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new TaskImpl(inner1, this.manager())); + } + + public Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskName, + Context context) { + Response inner + = this.serviceClient().getDetailsWithResponse(resourceGroupName, registryName, taskName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new TaskImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Task getDetails(String resourceGroupName, String registryName, String taskName) { + TaskInner inner = this.serviceClient().getDetails(resourceGroupName, registryName, taskName); + if (inner != null) { + return new TaskImpl(inner, this.manager()); + } else { + return null; + } + } + + public Task getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskName = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (taskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + return this.getWithResponse(resourceGroupName, registryName, taskName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskName = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (taskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + return this.getWithResponse(resourceGroupName, registryName, taskName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskName = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (taskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + this.deleteWithResponse(resourceGroupName, registryName, taskName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 registryName = ResourceManagerUtils.getValueFromIdByName(id, "registries"); + if (registryName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'registries'.", id))); + } + String taskName = ResourceManagerUtils.getValueFromIdByName(id, "tasks"); + if (taskName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tasks'.", id))); + } + return this.deleteWithResponse(resourceGroupName, registryName, taskName, context); + } + + private TasksClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager() { + return this.serviceManager; + } + + public TaskImpl define(String name) { + return new TaskImpl(name, this.manager()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/AgentPoolListResult.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/AgentPoolListResult.java new file mode 100644 index 000000000000..d1593920fb54 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/AgentPoolListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner; +import java.io.IOException; +import java.util.List; + +/** + * The collection of agent pools. + */ +@Immutable +public final class AgentPoolListResult implements JsonSerializable { + /* + * The collection value. + */ + private List value; + + /* + * The URI that can be used to request the next set of paged results. + */ + private String nextLink; + + /** + * Creates an instance of AgentPoolListResult class. + */ + private AgentPoolListResult() { + } + + /** + * Get the value property: The collection value. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI that can be used to request the next set of paged results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPoolListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPoolListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentPoolListResult. + */ + public static AgentPoolListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPoolListResult deserializedAgentPoolListResult = new AgentPoolListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> AgentPoolInner.fromJson(reader1)); + deserializedAgentPoolListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAgentPoolListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPoolListResult; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/RunListResult.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/RunListResult.java new file mode 100644 index 000000000000..926649fc662e --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/RunListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; +import java.io.IOException; +import java.util.List; + +/** + * The collection of runs. + */ +@Immutable +public final class RunListResult implements JsonSerializable { + /* + * The collection value. + */ + private List value; + + /* + * The URI that can be used to request the next set of paged results. + */ + private String nextLink; + + /** + * Creates an instance of RunListResult class. + */ + private RunListResult() { + } + + /** + * Get the value property: The collection value. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI that can be used to request the next set of paged results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RunListResult. + */ + public static RunListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunListResult deserializedRunListResult = new RunListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RunInner.fromJson(reader1)); + deserializedRunListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedRunListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRunListResult; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskListResult.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskListResult.java new file mode 100644 index 000000000000..0ba51195a295 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner; +import java.io.IOException; +import java.util.List; + +/** + * The collection of tasks. + */ +@Immutable +public final class TaskListResult implements JsonSerializable { + /* + * The collection value. + */ + private List value; + + /* + * The URI that can be used to request the next set of paged results. + */ + private String nextLink; + + /** + * Creates an instance of TaskListResult class. + */ + private TaskListResult() { + } + + /** + * Get the value property: The collection value. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI that can be used to request the next set of paged results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskListResult. + */ + public static TaskListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskListResult deserializedTaskListResult = new TaskListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> TaskInner.fromJson(reader1)); + deserializedTaskListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTaskListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskListResult; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskRunListResult.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskRunListResult.java new file mode 100644 index 000000000000..cf9b5731ac3b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskRunListResult.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner; +import java.io.IOException; +import java.util.List; + +/** + * The collection of task runs. + */ +@Immutable +public final class TaskRunListResult implements JsonSerializable { + /* + * The collection value. + */ + private List value; + + /* + * The URI that can be used to request the next set of paged results. + */ + private String nextLink; + + /** + * Creates an instance of TaskRunListResult class. + */ + private TaskRunListResult() { + } + + /** + * Get the value property: The collection value. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The URI that can be used to request the next set of paged results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskRunListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskRunListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskRunListResult. + */ + public static TaskRunListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskRunListResult deserializedTaskRunListResult = new TaskRunListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> TaskRunInner.fromJson(reader1)); + deserializedTaskRunListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedTaskRunListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskRunListResult; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/package-info.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/package-info.java new file mode 100644 index 000000000000..f45f89169a6d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for ContainerRegistryTasks. + * The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for + * Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry + * components. + */ +package com.azure.resourcemanager.containerregistry.tasks.implementation; diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPool.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPool.java new file mode 100644 index 000000000000..97b2d7a830aa --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPool.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner; +import java.util.Map; + +/** + * An immutable client-side representation of AgentPool. + */ +public interface AgentPool { + /** + * 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 properties property: The properties associated with the agent pool. + * + * @return the properties value. + */ + AgentPoolProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner object. + * + * @return the inner object. + */ + AgentPoolInner innerModel(); + + /** + * The entirety of the AgentPool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The AgentPool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AgentPool definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the AgentPool 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the AgentPool definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, registryName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @return the next definition stage. + */ + WithCreate withExistingRegistry(String resourceGroupName, String registryName); + } + + /** + * The stage of the AgentPool 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, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + AgentPool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AgentPool create(Context context); + } + + /** + * The stage of the AgentPool 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); + } + + /** + * The stage of the AgentPool definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The properties associated with the agent pool. + * + * @param properties The properties associated with the agent pool. + * @return the next definition stage. + */ + WithCreate withProperties(AgentPoolProperties properties); + } + } + + /** + * Begins update for the AgentPool resource. + * + * @return the stage of resource update. + */ + AgentPool.Update update(); + + /** + * The template for AgentPool update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithCount { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AgentPool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AgentPool apply(Context context); + } + + /** + * The AgentPool update stages. + */ + interface UpdateStages { + /** + * The stage of the AgentPool update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The ARM resource tags.. + * + * @param tags The ARM resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the AgentPool update allowing to specify count. + */ + interface WithCount { + /** + * Specifies the count property: The count of agent machine. + * + * @param count The count of agent machine. + * @return the next definition stage. + */ + Update withCount(Integer count); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AgentPool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AgentPool refresh(Context context); + + /** + * Gets the count of queued runs for a given agent pool. + * + * @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 count of queued runs for a given agent pool along with {@link Response}. + */ + Response getQueueStatusWithResponse(Context context); + + /** + * Gets the count of queued runs for a given agent pool. + * + * @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 count of queued runs for a given agent pool. + */ + AgentPoolQueueStatus getQueueStatus(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolProperties.java new file mode 100644 index 000000000000..3eced8ec3749 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolProperties.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of agent pool. + */ +@Fluent +public final class AgentPoolProperties implements JsonSerializable { + /* + * The count of agent machine + */ + private Integer count; + + /* + * The Tier of agent machine + */ + private String tier; + + /* + * The OS of agent machine + */ + private OS os; + + /* + * The Virtual Network Subnet Resource Id of the agent machine + */ + private String virtualNetworkSubnetResourceId; + + /* + * The provisioning state of this agent pool + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of AgentPoolProperties class. + */ + public AgentPoolProperties() { + } + + /** + * Get the count property: The count of agent machine. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Set the count property: The count of agent machine. + * + * @param count the count value to set. + * @return the AgentPoolProperties object itself. + */ + public AgentPoolProperties withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get the tier property: The Tier of agent machine. + * + * @return the tier value. + */ + public String tier() { + return this.tier; + } + + /** + * Set the tier property: The Tier of agent machine. + * + * @param tier the tier value to set. + * @return the AgentPoolProperties object itself. + */ + public AgentPoolProperties withTier(String tier) { + this.tier = tier; + return this; + } + + /** + * Get the os property: The OS of agent machine. + * + * @return the os value. + */ + public OS os() { + return this.os; + } + + /** + * Set the os property: The OS of agent machine. + * + * @param os the os value to set. + * @return the AgentPoolProperties object itself. + */ + public AgentPoolProperties withOs(OS os) { + this.os = os; + return this; + } + + /** + * Get the virtualNetworkSubnetResourceId property: The Virtual Network Subnet Resource Id of the agent machine. + * + * @return the virtualNetworkSubnetResourceId value. + */ + public String virtualNetworkSubnetResourceId() { + return this.virtualNetworkSubnetResourceId; + } + + /** + * Set the virtualNetworkSubnetResourceId property: The Virtual Network Subnet Resource Id of the agent machine. + * + * @param virtualNetworkSubnetResourceId the virtualNetworkSubnetResourceId value to set. + * @return the AgentPoolProperties object itself. + */ + public AgentPoolProperties withVirtualNetworkSubnetResourceId(String virtualNetworkSubnetResourceId) { + this.virtualNetworkSubnetResourceId = virtualNetworkSubnetResourceId; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of this agent pool. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("count", this.count); + jsonWriter.writeStringField("tier", this.tier); + jsonWriter.writeStringField("os", this.os == null ? null : this.os.toString()); + jsonWriter.writeStringField("virtualNetworkSubnetResourceId", this.virtualNetworkSubnetResourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPoolProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPoolProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentPoolProperties. + */ + public static AgentPoolProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPoolProperties deserializedAgentPoolProperties = new AgentPoolProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("count".equals(fieldName)) { + deserializedAgentPoolProperties.count = reader.getNullable(JsonReader::getInt); + } else if ("tier".equals(fieldName)) { + deserializedAgentPoolProperties.tier = reader.getString(); + } else if ("os".equals(fieldName)) { + deserializedAgentPoolProperties.os = OS.fromString(reader.getString()); + } else if ("virtualNetworkSubnetResourceId".equals(fieldName)) { + deserializedAgentPoolProperties.virtualNetworkSubnetResourceId = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedAgentPoolProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPoolProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolQueueStatus.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolQueueStatus.java new file mode 100644 index 000000000000..90b033c17314 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolQueueStatus.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner; + +/** + * An immutable client-side representation of AgentPoolQueueStatus. + */ +public interface AgentPoolQueueStatus { + /** + * Gets the count property: The number of pending runs in the queue. + * + * @return the count value. + */ + Integer count(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner object. + * + * @return the inner object. + */ + AgentPoolQueueStatusInner innerModel(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolUpdateParameters.java new file mode 100644 index 000000000000..f96a5b053c26 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolUpdateParameters.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolPropertiesUpdateParameters; +import java.io.IOException; +import java.util.Map; + +/** + * The parameters for updating an agent pool. + */ +@Fluent +public final class AgentPoolUpdateParameters implements JsonSerializable { + /* + * The properties associated with the agent pool + */ + private AgentPoolPropertiesUpdateParameters innerProperties; + + /* + * The ARM resource tags. + */ + private Map tags; + + /** + * Creates an instance of AgentPoolUpdateParameters class. + */ + public AgentPoolUpdateParameters() { + } + + /** + * Get the innerProperties property: The properties associated with the agent pool. + * + * @return the innerProperties value. + */ + private AgentPoolPropertiesUpdateParameters innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: The ARM resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The ARM resource tags. + * + * @param tags the tags value to set. + * @return the AgentPoolUpdateParameters object itself. + */ + public AgentPoolUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the count property: The count of agent machine. + * + * @return the count value. + */ + public Integer count() { + return this.innerProperties() == null ? null : this.innerProperties().count(); + } + + /** + * Set the count property: The count of agent machine. + * + * @param count the count value to set. + * @return the AgentPoolUpdateParameters object itself. + */ + public AgentPoolUpdateParameters withCount(Integer count) { + if (this.innerProperties() == null) { + this.innerProperties = new AgentPoolPropertiesUpdateParameters(); + } + this.innerProperties().withCount(count); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentPoolUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentPoolUpdateParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentPoolUpdateParameters. + */ + public static AgentPoolUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentPoolUpdateParameters deserializedAgentPoolUpdateParameters = new AgentPoolUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedAgentPoolUpdateParameters.innerProperties + = AgentPoolPropertiesUpdateParameters.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAgentPoolUpdateParameters.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedAgentPoolUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPools.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPools.java new file mode 100644 index 000000000000..35238943f8e3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPools.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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 AgentPools. + */ +public interface AgentPools { + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String registryName, String agentPoolName, + Context context); + + /** + * Gets the detailed information for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 detailed information for a given agent pool. + */ + AgentPool get(String resourceGroupName, String registryName, String agentPoolName); + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 delete(String resourceGroupName, String registryName, String agentPoolName); + + /** + * Deletes a specified agent pool resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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. + */ + void delete(String resourceGroupName, String registryName, String agentPoolName, Context context); + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Lists all the agent pools for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of agent pools as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName, Context context); + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool along with {@link Response}. + */ + Response getQueueStatusWithResponse(String resourceGroupName, String registryName, + String agentPoolName, Context context); + + /** + * Gets the count of queued runs for a given agent pool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param agentPoolName The name of the agent pool. + * @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 count of queued runs for a given agent pool. + */ + AgentPoolQueueStatus getQueueStatus(String resourceGroupName, String registryName, String agentPoolName); + + /** + * Gets the detailed information for a given agent pool. + * + * @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 the detailed information for a given agent pool along with {@link Response}. + */ + AgentPool getById(String id); + + /** + * Gets the detailed information for a given agent pool. + * + * @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 detailed information for a given agent pool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified agent pool resource. + * + * @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 a specified agent pool resource. + * + * @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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AgentPool resource. + * + * @param name resource name. + * @return the first stage of the new AgentPool definition. + */ + AgentPool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentProperties.java new file mode 100644 index 000000000000..b3d1e1083ecc --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentProperties.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties that determine the run agent configuration. + */ +@Fluent +public final class AgentProperties implements JsonSerializable { + /* + * The CPU configuration in terms of number of cores required for the run. + */ + private Integer cpu; + + /** + * Creates an instance of AgentProperties class. + */ + public AgentProperties() { + } + + /** + * Get the cpu property: The CPU configuration in terms of number of cores required for the run. + * + * @return the cpu value. + */ + public Integer cpu() { + return this.cpu; + } + + /** + * Set the cpu property: The CPU configuration in terms of number of cores required for the run. + * + * @param cpu the cpu value to set. + * @return the AgentProperties object itself. + */ + public AgentProperties withCpu(Integer cpu) { + this.cpu = cpu; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("cpu", this.cpu); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AgentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AgentProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the AgentProperties. + */ + public static AgentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AgentProperties deserializedAgentProperties = new AgentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("cpu".equals(fieldName)) { + deserializedAgentProperties.cpu = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAgentProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Architecture.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Architecture.java new file mode 100644 index 000000000000..d622aff05b26 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Architecture.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The OS architecture. + */ +public final class Architecture extends ExpandableStringEnum { + /** + * Static value amd64 for Architecture. + */ + public static final Architecture AMD64 = fromString("amd64"); + + /** + * Static value x86 for Architecture. + */ + public static final Architecture X86 = fromString("x86"); + + /** + * Static value 386 for Architecture. + */ + public static final Architecture THREE_EIGHT_SIX = fromString("386"); + + /** + * Static value arm for Architecture. + */ + public static final Architecture ARM = fromString("arm"); + + /** + * Static value arm64 for Architecture. + */ + public static final Architecture ARM64 = fromString("arm64"); + + /** + * Creates a new instance of Architecture value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Architecture() { + } + + /** + * Creates or finds a Architecture from its string representation. + * + * @param name a name to look for. + * @return the corresponding Architecture. + */ + public static Architecture fromString(String name) { + return fromString(name, Architecture.class); + } + + /** + * Gets known Architecture values. + * + * @return known Architecture values. + */ + public static Collection values() { + return values(Architecture.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Argument.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Argument.java new file mode 100644 index 000000000000..88fb86a4e1e2 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Argument.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a run argument. + */ +@Fluent +public final class Argument implements JsonSerializable { + /* + * The name of the argument. + */ + private String name; + + /* + * The value of the argument. + */ + private String value; + + /* + * Flag to indicate whether the argument represents a secret and want to be removed from build logs. + */ + private Boolean isSecret; + + /** + * Creates an instance of Argument class. + */ + public Argument() { + } + + /** + * Get the name property: The name of the argument. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the argument. + * + * @param name the name value to set. + * @return the Argument object itself. + */ + public Argument withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the argument. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the argument. + * + * @param value the value value to set. + * @return the Argument object itself. + */ + public Argument withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the isSecret property: Flag to indicate whether the argument represents a secret and want to be removed from + * build logs. + * + * @return the isSecret value. + */ + public Boolean isSecret() { + return this.isSecret; + } + + /** + * Set the isSecret property: Flag to indicate whether the argument represents a secret and want to be removed from + * build logs. + * + * @param isSecret the isSecret value to set. + * @return the Argument object itself. + */ + public Argument withIsSecret(Boolean isSecret) { + this.isSecret = isSecret; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeBooleanField("isSecret", this.isSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Argument from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Argument if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Argument. + */ + public static Argument fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Argument deserializedArgument = new Argument(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedArgument.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedArgument.value = reader.getString(); + } else if ("isSecret".equals(fieldName)) { + deserializedArgument.isSecret = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedArgument; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfo.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfo.java new file mode 100644 index 000000000000..4af347718b1c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfo.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The authorization properties for accessing the source code repository. + */ +@Fluent +public final class AuthInfo implements JsonSerializable { + /* + * The type of Auth token. + */ + private TokenType tokenType; + + /* + * The access token used to access the source control provider. + */ + private String token; + + /* + * The refresh token used to refresh the access token. + */ + private String refreshToken; + + /* + * The scope of the access token. + */ + private String scope; + + /* + * Time in seconds that the token remains valid + */ + private Integer expiresIn; + + /** + * Creates an instance of AuthInfo class. + */ + public AuthInfo() { + } + + /** + * Get the tokenType property: The type of Auth token. + * + * @return the tokenType value. + */ + public TokenType tokenType() { + return this.tokenType; + } + + /** + * Set the tokenType property: The type of Auth token. + * + * @param tokenType the tokenType value to set. + * @return the AuthInfo object itself. + */ + public AuthInfo withTokenType(TokenType tokenType) { + this.tokenType = tokenType; + return this; + } + + /** + * Get the token property: The access token used to access the source control provider. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Set the token property: The access token used to access the source control provider. + * + * @param token the token value to set. + * @return the AuthInfo object itself. + */ + public AuthInfo withToken(String token) { + this.token = token; + return this; + } + + /** + * Get the refreshToken property: The refresh token used to refresh the access token. + * + * @return the refreshToken value. + */ + public String refreshToken() { + return this.refreshToken; + } + + /** + * Set the refreshToken property: The refresh token used to refresh the access token. + * + * @param refreshToken the refreshToken value to set. + * @return the AuthInfo object itself. + */ + public AuthInfo withRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + return this; + } + + /** + * Get the scope property: The scope of the access token. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The scope of the access token. + * + * @param scope the scope value to set. + * @return the AuthInfo object itself. + */ + public AuthInfo withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the expiresIn property: Time in seconds that the token remains valid. + * + * @return the expiresIn value. + */ + public Integer expiresIn() { + return this.expiresIn; + } + + /** + * Set the expiresIn property: Time in seconds that the token remains valid. + * + * @param expiresIn the expiresIn value to set. + * @return the AuthInfo object itself. + */ + public AuthInfo withExpiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tokenType", this.tokenType == null ? null : this.tokenType.toString()); + jsonWriter.writeStringField("token", this.token); + jsonWriter.writeStringField("refreshToken", this.refreshToken); + jsonWriter.writeStringField("scope", this.scope); + jsonWriter.writeNumberField("expiresIn", this.expiresIn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AuthInfo from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AuthInfo if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AuthInfo. + */ + public static AuthInfo fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AuthInfo deserializedAuthInfo = new AuthInfo(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tokenType".equals(fieldName)) { + deserializedAuthInfo.tokenType = TokenType.fromString(reader.getString()); + } else if ("token".equals(fieldName)) { + deserializedAuthInfo.token = reader.getString(); + } else if ("refreshToken".equals(fieldName)) { + deserializedAuthInfo.refreshToken = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedAuthInfo.scope = reader.getString(); + } else if ("expiresIn".equals(fieldName)) { + deserializedAuthInfo.expiresIn = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAuthInfo; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfoUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfoUpdateParameters.java new file mode 100644 index 000000000000..7c67df8f6308 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfoUpdateParameters.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The authorization properties for accessing the source code repository. + */ +@Fluent +public final class AuthInfoUpdateParameters implements JsonSerializable { + /* + * The type of Auth token. + */ + private TokenType tokenType; + + /* + * The access token used to access the source control provider. + */ + private String token; + + /* + * The refresh token used to refresh the access token. + */ + private String refreshToken; + + /* + * The scope of the access token. + */ + private String scope; + + /* + * Time in seconds that the token remains valid + */ + private Integer expiresIn; + + /** + * Creates an instance of AuthInfoUpdateParameters class. + */ + public AuthInfoUpdateParameters() { + } + + /** + * Get the tokenType property: The type of Auth token. + * + * @return the tokenType value. + */ + public TokenType tokenType() { + return this.tokenType; + } + + /** + * Set the tokenType property: The type of Auth token. + * + * @param tokenType the tokenType value to set. + * @return the AuthInfoUpdateParameters object itself. + */ + public AuthInfoUpdateParameters withTokenType(TokenType tokenType) { + this.tokenType = tokenType; + return this; + } + + /** + * Get the token property: The access token used to access the source control provider. + * + * @return the token value. + */ + public String token() { + return this.token; + } + + /** + * Set the token property: The access token used to access the source control provider. + * + * @param token the token value to set. + * @return the AuthInfoUpdateParameters object itself. + */ + public AuthInfoUpdateParameters withToken(String token) { + this.token = token; + return this; + } + + /** + * Get the refreshToken property: The refresh token used to refresh the access token. + * + * @return the refreshToken value. + */ + public String refreshToken() { + return this.refreshToken; + } + + /** + * Set the refreshToken property: The refresh token used to refresh the access token. + * + * @param refreshToken the refreshToken value to set. + * @return the AuthInfoUpdateParameters object itself. + */ + public AuthInfoUpdateParameters withRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + return this; + } + + /** + * Get the scope property: The scope of the access token. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: The scope of the access token. + * + * @param scope the scope value to set. + * @return the AuthInfoUpdateParameters object itself. + */ + public AuthInfoUpdateParameters withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Get the expiresIn property: Time in seconds that the token remains valid. + * + * @return the expiresIn value. + */ + public Integer expiresIn() { + return this.expiresIn; + } + + /** + * Set the expiresIn property: Time in seconds that the token remains valid. + * + * @param expiresIn the expiresIn value to set. + * @return the AuthInfoUpdateParameters object itself. + */ + public AuthInfoUpdateParameters withExpiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("tokenType", this.tokenType == null ? null : this.tokenType.toString()); + jsonWriter.writeStringField("token", this.token); + jsonWriter.writeStringField("refreshToken", this.refreshToken); + jsonWriter.writeStringField("scope", this.scope); + jsonWriter.writeNumberField("expiresIn", this.expiresIn); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AuthInfoUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AuthInfoUpdateParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the AuthInfoUpdateParameters. + */ + public static AuthInfoUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AuthInfoUpdateParameters deserializedAuthInfoUpdateParameters = new AuthInfoUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tokenType".equals(fieldName)) { + deserializedAuthInfoUpdateParameters.tokenType = TokenType.fromString(reader.getString()); + } else if ("token".equals(fieldName)) { + deserializedAuthInfoUpdateParameters.token = reader.getString(); + } else if ("refreshToken".equals(fieldName)) { + deserializedAuthInfoUpdateParameters.refreshToken = reader.getString(); + } else if ("scope".equals(fieldName)) { + deserializedAuthInfoUpdateParameters.scope = reader.getString(); + } else if ("expiresIn".equals(fieldName)) { + deserializedAuthInfoUpdateParameters.expiresIn = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedAuthInfoUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependency.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependency.java new file mode 100644 index 000000000000..9050d4619ddb --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependency.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties that describe a base image dependency. + */ +@Immutable +public final class BaseImageDependency implements JsonSerializable { + /* + * The type of the base image dependency. + */ + private BaseImageDependencyType type; + + /* + * The registry login server. + */ + private String registry; + + /* + * The repository name. + */ + private String repository; + + /* + * The tag name. + */ + private String tag; + + /* + * The sha256-based digest of the image manifest. + */ + private String digest; + + /** + * Creates an instance of BaseImageDependency class. + */ + private BaseImageDependency() { + } + + /** + * Get the type property: The type of the base image dependency. + * + * @return the type value. + */ + public BaseImageDependencyType type() { + return this.type; + } + + /** + * Get the registry property: The registry login server. + * + * @return the registry value. + */ + public String registry() { + return this.registry; + } + + /** + * Get the repository property: The repository name. + * + * @return the repository value. + */ + public String repository() { + return this.repository; + } + + /** + * Get the tag property: The tag name. + * + * @return the tag value. + */ + public String tag() { + return this.tag; + } + + /** + * Get the digest property: The sha256-based digest of the image manifest. + * + * @return the digest value. + */ + public String digest() { + return this.digest; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("registry", this.registry); + jsonWriter.writeStringField("repository", this.repository); + jsonWriter.writeStringField("tag", this.tag); + jsonWriter.writeStringField("digest", this.digest); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BaseImageDependency from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BaseImageDependency if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BaseImageDependency. + */ + public static BaseImageDependency fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BaseImageDependency deserializedBaseImageDependency = new BaseImageDependency(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedBaseImageDependency.type = BaseImageDependencyType.fromString(reader.getString()); + } else if ("registry".equals(fieldName)) { + deserializedBaseImageDependency.registry = reader.getString(); + } else if ("repository".equals(fieldName)) { + deserializedBaseImageDependency.repository = reader.getString(); + } else if ("tag".equals(fieldName)) { + deserializedBaseImageDependency.tag = reader.getString(); + } else if ("digest".equals(fieldName)) { + deserializedBaseImageDependency.digest = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBaseImageDependency; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependencyType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependencyType.java new file mode 100644 index 000000000000..51d63f947205 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependencyType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the base image dependency. + */ +public final class BaseImageDependencyType extends ExpandableStringEnum { + /** + * Static value BuildTime for BaseImageDependencyType. + */ + public static final BaseImageDependencyType BUILD_TIME = fromString("BuildTime"); + + /** + * Static value RunTime for BaseImageDependencyType. + */ + public static final BaseImageDependencyType RUN_TIME = fromString("RunTime"); + + /** + * Creates a new instance of BaseImageDependencyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BaseImageDependencyType() { + } + + /** + * Creates or finds a BaseImageDependencyType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BaseImageDependencyType. + */ + public static BaseImageDependencyType fromString(String name) { + return fromString(name, BaseImageDependencyType.class); + } + + /** + * Gets known BaseImageDependencyType values. + * + * @return known BaseImageDependencyType values. + */ + public static Collection values() { + return values(BaseImageDependencyType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTrigger.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTrigger.java new file mode 100644 index 000000000000..b04dbe05b57c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTrigger.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The trigger based on base image dependency. + */ +@Fluent +public final class BaseImageTrigger implements JsonSerializable { + /* + * The type of the auto trigger for base image dependency updates. + */ + private BaseImageTriggerType baseImageTriggerType; + + /* + * The endpoint URL for receiving update triggers. + */ + private String updateTriggerEndpoint; + + /* + * Type of Payload body for Base image update triggers. + */ + private UpdateTriggerPayloadType updateTriggerPayloadType; + + /* + * The current status of trigger. + */ + private TriggerStatus status; + + /* + * The name of the trigger. + */ + private String name; + + /** + * Creates an instance of BaseImageTrigger class. + */ + public BaseImageTrigger() { + } + + /** + * Get the baseImageTriggerType property: The type of the auto trigger for base image dependency updates. + * + * @return the baseImageTriggerType value. + */ + public BaseImageTriggerType baseImageTriggerType() { + return this.baseImageTriggerType; + } + + /** + * Set the baseImageTriggerType property: The type of the auto trigger for base image dependency updates. + * + * @param baseImageTriggerType the baseImageTriggerType value to set. + * @return the BaseImageTrigger object itself. + */ + public BaseImageTrigger withBaseImageTriggerType(BaseImageTriggerType baseImageTriggerType) { + this.baseImageTriggerType = baseImageTriggerType; + return this; + } + + /** + * Get the updateTriggerEndpoint property: The endpoint URL for receiving update triggers. + * + * @return the updateTriggerEndpoint value. + */ + public String updateTriggerEndpoint() { + return this.updateTriggerEndpoint; + } + + /** + * Set the updateTriggerEndpoint property: The endpoint URL for receiving update triggers. + * + * @param updateTriggerEndpoint the updateTriggerEndpoint value to set. + * @return the BaseImageTrigger object itself. + */ + public BaseImageTrigger withUpdateTriggerEndpoint(String updateTriggerEndpoint) { + this.updateTriggerEndpoint = updateTriggerEndpoint; + return this; + } + + /** + * Get the updateTriggerPayloadType property: Type of Payload body for Base image update triggers. + * + * @return the updateTriggerPayloadType value. + */ + public UpdateTriggerPayloadType updateTriggerPayloadType() { + return this.updateTriggerPayloadType; + } + + /** + * Set the updateTriggerPayloadType property: Type of Payload body for Base image update triggers. + * + * @param updateTriggerPayloadType the updateTriggerPayloadType value to set. + * @return the BaseImageTrigger object itself. + */ + public BaseImageTrigger withUpdateTriggerPayloadType(UpdateTriggerPayloadType updateTriggerPayloadType) { + this.updateTriggerPayloadType = updateTriggerPayloadType; + return this; + } + + /** + * Get the status property: The current status of trigger. + * + * @return the status value. + */ + public TriggerStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of trigger. + * + * @param status the status value to set. + * @return the BaseImageTrigger object itself. + */ + public BaseImageTrigger withStatus(TriggerStatus status) { + this.status = status; + return this; + } + + /** + * Get the name property: The name of the trigger. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the trigger. + * + * @param name the name value to set. + * @return the BaseImageTrigger object itself. + */ + public BaseImageTrigger withName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("baseImageTriggerType", + this.baseImageTriggerType == null ? null : this.baseImageTriggerType.toString()); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("updateTriggerEndpoint", this.updateTriggerEndpoint); + jsonWriter.writeStringField("updateTriggerPayloadType", + this.updateTriggerPayloadType == null ? null : this.updateTriggerPayloadType.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BaseImageTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BaseImageTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BaseImageTrigger. + */ + public static BaseImageTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BaseImageTrigger deserializedBaseImageTrigger = new BaseImageTrigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("baseImageTriggerType".equals(fieldName)) { + deserializedBaseImageTrigger.baseImageTriggerType + = BaseImageTriggerType.fromString(reader.getString()); + } else if ("name".equals(fieldName)) { + deserializedBaseImageTrigger.name = reader.getString(); + } else if ("updateTriggerEndpoint".equals(fieldName)) { + deserializedBaseImageTrigger.updateTriggerEndpoint = reader.getString(); + } else if ("updateTriggerPayloadType".equals(fieldName)) { + deserializedBaseImageTrigger.updateTriggerPayloadType + = UpdateTriggerPayloadType.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedBaseImageTrigger.status = TriggerStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBaseImageTrigger; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerType.java new file mode 100644 index 000000000000..94f5afdc40c9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the auto trigger for base image dependency updates. + */ +public final class BaseImageTriggerType extends ExpandableStringEnum { + /** + * Static value All for BaseImageTriggerType. + */ + public static final BaseImageTriggerType ALL = fromString("All"); + + /** + * Static value Runtime for BaseImageTriggerType. + */ + public static final BaseImageTriggerType RUNTIME = fromString("Runtime"); + + /** + * Creates a new instance of BaseImageTriggerType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BaseImageTriggerType() { + } + + /** + * Creates or finds a BaseImageTriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding BaseImageTriggerType. + */ + public static BaseImageTriggerType fromString(String name) { + return fromString(name, BaseImageTriggerType.class); + } + + /** + * Gets known BaseImageTriggerType values. + * + * @return known BaseImageTriggerType values. + */ + public static Collection values() { + return values(BaseImageTriggerType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerUpdateParameters.java new file mode 100644 index 000000000000..67b6c3e8e0b0 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerUpdateParameters.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties for updating base image dependency trigger. + */ +@Fluent +public final class BaseImageTriggerUpdateParameters implements JsonSerializable { + /* + * The type of the auto trigger for base image dependency updates. + */ + private BaseImageTriggerType baseImageTriggerType; + + /* + * The endpoint URL for receiving update triggers. + */ + private String updateTriggerEndpoint; + + /* + * Type of Payload body for Base image update triggers. + */ + private UpdateTriggerPayloadType updateTriggerPayloadType; + + /* + * The current status of trigger. + */ + private TriggerStatus status; + + /* + * The name of the trigger. + */ + private String name; + + /** + * Creates an instance of BaseImageTriggerUpdateParameters class. + */ + public BaseImageTriggerUpdateParameters() { + } + + /** + * Get the baseImageTriggerType property: The type of the auto trigger for base image dependency updates. + * + * @return the baseImageTriggerType value. + */ + public BaseImageTriggerType baseImageTriggerType() { + return this.baseImageTriggerType; + } + + /** + * Set the baseImageTriggerType property: The type of the auto trigger for base image dependency updates. + * + * @param baseImageTriggerType the baseImageTriggerType value to set. + * @return the BaseImageTriggerUpdateParameters object itself. + */ + public BaseImageTriggerUpdateParameters withBaseImageTriggerType(BaseImageTriggerType baseImageTriggerType) { + this.baseImageTriggerType = baseImageTriggerType; + return this; + } + + /** + * Get the updateTriggerEndpoint property: The endpoint URL for receiving update triggers. + * + * @return the updateTriggerEndpoint value. + */ + public String updateTriggerEndpoint() { + return this.updateTriggerEndpoint; + } + + /** + * Set the updateTriggerEndpoint property: The endpoint URL for receiving update triggers. + * + * @param updateTriggerEndpoint the updateTriggerEndpoint value to set. + * @return the BaseImageTriggerUpdateParameters object itself. + */ + public BaseImageTriggerUpdateParameters withUpdateTriggerEndpoint(String updateTriggerEndpoint) { + this.updateTriggerEndpoint = updateTriggerEndpoint; + return this; + } + + /** + * Get the updateTriggerPayloadType property: Type of Payload body for Base image update triggers. + * + * @return the updateTriggerPayloadType value. + */ + public UpdateTriggerPayloadType updateTriggerPayloadType() { + return this.updateTriggerPayloadType; + } + + /** + * Set the updateTriggerPayloadType property: Type of Payload body for Base image update triggers. + * + * @param updateTriggerPayloadType the updateTriggerPayloadType value to set. + * @return the BaseImageTriggerUpdateParameters object itself. + */ + public BaseImageTriggerUpdateParameters + withUpdateTriggerPayloadType(UpdateTriggerPayloadType updateTriggerPayloadType) { + this.updateTriggerPayloadType = updateTriggerPayloadType; + return this; + } + + /** + * Get the status property: The current status of trigger. + * + * @return the status value. + */ + public TriggerStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of trigger. + * + * @param status the status value to set. + * @return the BaseImageTriggerUpdateParameters object itself. + */ + public BaseImageTriggerUpdateParameters withStatus(TriggerStatus status) { + this.status = status; + return this; + } + + /** + * Get the name property: The name of the trigger. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the trigger. + * + * @param name the name value to set. + * @return the BaseImageTriggerUpdateParameters object itself. + */ + public BaseImageTriggerUpdateParameters withName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("baseImageTriggerType", + this.baseImageTriggerType == null ? null : this.baseImageTriggerType.toString()); + jsonWriter.writeStringField("updateTriggerEndpoint", this.updateTriggerEndpoint); + jsonWriter.writeStringField("updateTriggerPayloadType", + this.updateTriggerPayloadType == null ? null : this.updateTriggerPayloadType.toString()); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BaseImageTriggerUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BaseImageTriggerUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BaseImageTriggerUpdateParameters. + */ + public static BaseImageTriggerUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BaseImageTriggerUpdateParameters deserializedBaseImageTriggerUpdateParameters + = new BaseImageTriggerUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedBaseImageTriggerUpdateParameters.name = reader.getString(); + } else if ("baseImageTriggerType".equals(fieldName)) { + deserializedBaseImageTriggerUpdateParameters.baseImageTriggerType + = BaseImageTriggerType.fromString(reader.getString()); + } else if ("updateTriggerEndpoint".equals(fieldName)) { + deserializedBaseImageTriggerUpdateParameters.updateTriggerEndpoint = reader.getString(); + } else if ("updateTriggerPayloadType".equals(fieldName)) { + deserializedBaseImageTriggerUpdateParameters.updateTriggerPayloadType + = UpdateTriggerPayloadType.fromString(reader.getString()); + } else if ("status".equals(fieldName)) { + deserializedBaseImageTriggerUpdateParameters.status = TriggerStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedBaseImageTriggerUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Credentials.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Credentials.java new file mode 100644 index 000000000000..052d879967b7 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Credentials.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The parameters that describes a set of credentials that will be used when a run is invoked. + */ +@Fluent +public final class Credentials implements JsonSerializable { + /* + * Describes the credential parameters for accessing the source registry. + */ + private SourceRegistryCredentials sourceRegistry; + + /* + * Describes the credential parameters for accessing other custom registries. The key + * for the dictionary item will be the registry login server (myregistry.azurecr.io) and + * the value of the item will be the registry credentials for accessing the registry. + */ + private Map customRegistries; + + /** + * Creates an instance of Credentials class. + */ + public Credentials() { + } + + /** + * Get the sourceRegistry property: Describes the credential parameters for accessing the source registry. + * + * @return the sourceRegistry value. + */ + public SourceRegistryCredentials sourceRegistry() { + return this.sourceRegistry; + } + + /** + * Set the sourceRegistry property: Describes the credential parameters for accessing the source registry. + * + * @param sourceRegistry the sourceRegistry value to set. + * @return the Credentials object itself. + */ + public Credentials withSourceRegistry(SourceRegistryCredentials sourceRegistry) { + this.sourceRegistry = sourceRegistry; + return this; + } + + /** + * Get the customRegistries property: Describes the credential parameters for accessing other custom registries. The + * key + * for the dictionary item will be the registry login server (myregistry.azurecr.io) and + * the value of the item will be the registry credentials for accessing the registry. + * + * @return the customRegistries value. + */ + public Map customRegistries() { + return this.customRegistries; + } + + /** + * Set the customRegistries property: Describes the credential parameters for accessing other custom registries. The + * key + * for the dictionary item will be the registry login server (myregistry.azurecr.io) and + * the value of the item will be the registry credentials for accessing the registry. + * + * @param customRegistries the customRegistries value to set. + * @return the Credentials object itself. + */ + public Credentials withCustomRegistries(Map customRegistries) { + this.customRegistries = customRegistries; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sourceRegistry", this.sourceRegistry); + jsonWriter.writeMapField("customRegistries", this.customRegistries, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Credentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Credentials if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the Credentials. + */ + public static Credentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Credentials deserializedCredentials = new Credentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceRegistry".equals(fieldName)) { + deserializedCredentials.sourceRegistry = SourceRegistryCredentials.fromJson(reader); + } else if ("customRegistries".equals(fieldName)) { + Map customRegistries + = reader.readMap(reader1 -> CustomRegistryCredentials.fromJson(reader1)); + deserializedCredentials.customRegistries = customRegistries; + } else { + reader.skipChildren(); + } + } + + return deserializedCredentials; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/CustomRegistryCredentials.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/CustomRegistryCredentials.java new file mode 100644 index 000000000000..d248bfb6d1bd --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/CustomRegistryCredentials.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the credentials that will be used to access a custom registry during a run. + */ +@Fluent +public final class CustomRegistryCredentials implements JsonSerializable { + /* + * The username for logging into the custom registry. + */ + private SecretObject userName; + + /* + * The password for logging into the custom registry. The password is a secret + * object that allows multiple ways of providing the value for it. + */ + private SecretObject password; + + /* + * Indicates the managed identity assigned to the custom credential. If a user-assigned identity + * this value is the Client ID. If a system-assigned identity, the value will be `system`. In + * the case of a system-assigned identity, the Client ID will be determined by the runner. This + * identity may be used to authenticate to key vault to retrieve credentials or it may be the only + * source of authentication used for accessing the registry. + */ + private String identity; + + /** + * Creates an instance of CustomRegistryCredentials class. + */ + public CustomRegistryCredentials() { + } + + /** + * Get the userName property: The username for logging into the custom registry. + * + * @return the userName value. + */ + public SecretObject userName() { + return this.userName; + } + + /** + * Set the userName property: The username for logging into the custom registry. + * + * @param userName the userName value to set. + * @return the CustomRegistryCredentials object itself. + */ + public CustomRegistryCredentials withUserName(SecretObject userName) { + this.userName = userName; + return this; + } + + /** + * Get the password property: The password for logging into the custom registry. The password is a secret + * object that allows multiple ways of providing the value for it. + * + * @return the password value. + */ + public SecretObject password() { + return this.password; + } + + /** + * Set the password property: The password for logging into the custom registry. The password is a secret + * object that allows multiple ways of providing the value for it. + * + * @param password the password value to set. + * @return the CustomRegistryCredentials object itself. + */ + public CustomRegistryCredentials withPassword(SecretObject password) { + this.password = password; + return this; + } + + /** + * Get the identity property: Indicates the managed identity assigned to the custom credential. If a user-assigned + * identity + * this value is the Client ID. If a system-assigned identity, the value will be `system`. In + * the case of a system-assigned identity, the Client ID will be determined by the runner. This + * identity may be used to authenticate to key vault to retrieve credentials or it may be the only + * source of authentication used for accessing the registry. + * + * @return the identity value. + */ + public String identity() { + return this.identity; + } + + /** + * Set the identity property: Indicates the managed identity assigned to the custom credential. If a user-assigned + * identity + * this value is the Client ID. If a system-assigned identity, the value will be `system`. In + * the case of a system-assigned identity, the Client ID will be determined by the runner. This + * identity may be used to authenticate to key vault to retrieve credentials or it may be the only + * source of authentication used for accessing the registry. + * + * @param identity the identity value to set. + * @return the CustomRegistryCredentials object itself. + */ + public CustomRegistryCredentials withIdentity(String identity) { + this.identity = identity; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("userName", this.userName); + jsonWriter.writeJsonField("password", this.password); + jsonWriter.writeStringField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CustomRegistryCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CustomRegistryCredentials if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CustomRegistryCredentials. + */ + public static CustomRegistryCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CustomRegistryCredentials deserializedCustomRegistryCredentials = new CustomRegistryCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("userName".equals(fieldName)) { + deserializedCustomRegistryCredentials.userName = SecretObject.fromJson(reader); + } else if ("password".equals(fieldName)) { + deserializedCustomRegistryCredentials.password = SecretObject.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedCustomRegistryCredentials.identity = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCustomRegistryCredentials; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildRequest.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildRequest.java new file mode 100644 index 000000000000..07b033245f98 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildRequest.java @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The parameters for a docker quick build. + */ +@Fluent +public final class DockerBuildRequest extends RunRequest { + /* + * The type of the run request. + */ + private String type = "DockerBuildRequest"; + + /* + * The fully qualified image names including the repository and tag. + */ + private List imageNames; + + /* + * The value of this property indicates whether the image built should be pushed to the registry or not. + */ + private Boolean isPushEnabled; + + /* + * The value of this property indicates whether the image cache is enabled or not. + */ + private Boolean noCache; + + /* + * The Docker file path relative to the source location. + */ + private String dockerFilePath; + + /* + * The name of the target build stage for the docker build. + */ + private String target; + + /* + * The collection of override arguments to be used when executing the run. + */ + private List arguments; + + /* + * Run timeout in seconds. + */ + private Integer timeout; + + /* + * The platform properties against which the run has to happen. + */ + private PlatformProperties platform; + + /* + * The machine configuration of the run agent. + */ + private AgentProperties agentConfiguration; + + /* + * The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + */ + private String sourceLocation; + + /* + * The properties that describes a set of credentials that will be used when this run is invoked. + */ + private Credentials credentials; + + /** + * Creates an instance of DockerBuildRequest class. + */ + public DockerBuildRequest() { + } + + /** + * Get the type property: The type of the run request. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the imageNames property: The fully qualified image names including the repository and tag. + * + * @return the imageNames value. + */ + public List imageNames() { + return this.imageNames; + } + + /** + * Set the imageNames property: The fully qualified image names including the repository and tag. + * + * @param imageNames the imageNames value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withImageNames(List imageNames) { + this.imageNames = imageNames; + return this; + } + + /** + * Get the isPushEnabled property: The value of this property indicates whether the image built should be pushed to + * the registry or not. + * + * @return the isPushEnabled value. + */ + public Boolean isPushEnabled() { + return this.isPushEnabled; + } + + /** + * Set the isPushEnabled property: The value of this property indicates whether the image built should be pushed to + * the registry or not. + * + * @param isPushEnabled the isPushEnabled value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withIsPushEnabled(Boolean isPushEnabled) { + this.isPushEnabled = isPushEnabled; + return this; + } + + /** + * Get the noCache property: The value of this property indicates whether the image cache is enabled or not. + * + * @return the noCache value. + */ + public Boolean noCache() { + return this.noCache; + } + + /** + * Set the noCache property: The value of this property indicates whether the image cache is enabled or not. + * + * @param noCache the noCache value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withNoCache(Boolean noCache) { + this.noCache = noCache; + return this; + } + + /** + * Get the dockerFilePath property: The Docker file path relative to the source location. + * + * @return the dockerFilePath value. + */ + public String dockerFilePath() { + return this.dockerFilePath; + } + + /** + * Set the dockerFilePath property: The Docker file path relative to the source location. + * + * @param dockerFilePath the dockerFilePath value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withDockerFilePath(String dockerFilePath) { + this.dockerFilePath = dockerFilePath; + return this; + } + + /** + * Get the target property: The name of the target build stage for the docker build. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The name of the target build stage for the docker build. + * + * @param target the target value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the arguments property: The collection of override arguments to be used when executing the run. + * + * @return the arguments value. + */ + public List arguments() { + return this.arguments; + } + + /** + * Set the arguments property: The collection of override arguments to be used when executing the run. + * + * @param arguments the arguments value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the timeout property: Run timeout in seconds. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Run timeout in seconds. + * + * @param timeout the timeout value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the platform property: The platform properties against which the run has to happen. + * + * @return the platform value. + */ + public PlatformProperties platform() { + return this.platform; + } + + /** + * Set the platform property: The platform properties against which the run has to happen. + * + * @param platform the platform value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withPlatform(PlatformProperties platform) { + this.platform = platform; + return this; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.agentConfiguration; + } + + /** + * Set the agentConfiguration property: The machine configuration of the run agent. + * + * @param agentConfiguration the agentConfiguration value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withAgentConfiguration(AgentProperties agentConfiguration) { + this.agentConfiguration = agentConfiguration; + return this; + } + + /** + * Get the sourceLocation property: The URL(absolute or relative) of the source context. It can be an URL to a tar + * or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The URL(absolute or relative) of the source context. It can be an URL to a tar + * or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + * + * @param sourceLocation the sourceLocation value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + /** + * Get the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @return the credentials value. + */ + public Credentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @param credentials the credentials value to set. + * @return the DockerBuildRequest object itself. + */ + public DockerBuildRequest withCredentials(Credentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildRequest withIsArchiveEnabled(Boolean isArchiveEnabled) { + super.withIsArchiveEnabled(isArchiveEnabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildRequest withAgentPoolName(String agentPoolName) { + super.withAgentPoolName(agentPoolName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildRequest withLogTemplate(String logTemplate) { + super.withLogTemplate(logTemplate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("agentPoolName", agentPoolName()); + jsonWriter.writeStringField("logTemplate", logTemplate()); + jsonWriter.writeStringField("dockerFilePath", this.dockerFilePath); + jsonWriter.writeJsonField("platform", this.platform); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeArrayField("imageNames", this.imageNames, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isPushEnabled", this.isPushEnabled); + jsonWriter.writeBooleanField("noCache", this.noCache); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeArrayField("arguments", this.arguments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("timeout", this.timeout); + jsonWriter.writeJsonField("agentConfiguration", this.agentConfiguration); + jsonWriter.writeStringField("sourceLocation", this.sourceLocation); + jsonWriter.writeJsonField("credentials", this.credentials); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DockerBuildRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DockerBuildRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DockerBuildRequest. + */ + public static DockerBuildRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DockerBuildRequest deserializedDockerBuildRequest = new DockerBuildRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isArchiveEnabled".equals(fieldName)) { + deserializedDockerBuildRequest.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("agentPoolName".equals(fieldName)) { + deserializedDockerBuildRequest.withAgentPoolName(reader.getString()); + } else if ("logTemplate".equals(fieldName)) { + deserializedDockerBuildRequest.withLogTemplate(reader.getString()); + } else if ("dockerFilePath".equals(fieldName)) { + deserializedDockerBuildRequest.dockerFilePath = reader.getString(); + } else if ("platform".equals(fieldName)) { + deserializedDockerBuildRequest.platform = PlatformProperties.fromJson(reader); + } else if ("type".equals(fieldName)) { + deserializedDockerBuildRequest.type = reader.getString(); + } else if ("imageNames".equals(fieldName)) { + List imageNames = reader.readArray(reader1 -> reader1.getString()); + deserializedDockerBuildRequest.imageNames = imageNames; + } else if ("isPushEnabled".equals(fieldName)) { + deserializedDockerBuildRequest.isPushEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("noCache".equals(fieldName)) { + deserializedDockerBuildRequest.noCache = reader.getNullable(JsonReader::getBoolean); + } else if ("target".equals(fieldName)) { + deserializedDockerBuildRequest.target = reader.getString(); + } else if ("arguments".equals(fieldName)) { + List arguments = reader.readArray(reader1 -> Argument.fromJson(reader1)); + deserializedDockerBuildRequest.arguments = arguments; + } else if ("timeout".equals(fieldName)) { + deserializedDockerBuildRequest.timeout = reader.getNullable(JsonReader::getInt); + } else if ("agentConfiguration".equals(fieldName)) { + deserializedDockerBuildRequest.agentConfiguration = AgentProperties.fromJson(reader); + } else if ("sourceLocation".equals(fieldName)) { + deserializedDockerBuildRequest.sourceLocation = reader.getString(); + } else if ("credentials".equals(fieldName)) { + deserializedDockerBuildRequest.credentials = Credentials.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDockerBuildRequest; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStep.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStep.java new file mode 100644 index 000000000000..bc4b81095363 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStep.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The Docker build step. + */ +@Fluent +public final class DockerBuildStep extends TaskStepProperties { + /* + * The type of the step. + */ + private StepType type = StepType.DOCKER; + + /* + * The fully qualified image names including the repository and tag. + */ + private List imageNames; + + /* + * The value of this property indicates whether the image built should be pushed to the registry or not. + */ + private Boolean isPushEnabled; + + /* + * The value of this property indicates whether the image cache is enabled or not. + */ + private Boolean noCache; + + /* + * The Docker file path relative to the source context. + */ + private String dockerFilePath; + + /* + * The name of the target build stage for the docker build. + */ + private String target; + + /* + * The collection of override arguments to be used when executing this build step. + */ + private List arguments; + + /** + * Creates an instance of DockerBuildStep class. + */ + public DockerBuildStep() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + @Override + public StepType type() { + return this.type; + } + + /** + * Get the imageNames property: The fully qualified image names including the repository and tag. + * + * @return the imageNames value. + */ + public List imageNames() { + return this.imageNames; + } + + /** + * Set the imageNames property: The fully qualified image names including the repository and tag. + * + * @param imageNames the imageNames value to set. + * @return the DockerBuildStep object itself. + */ + public DockerBuildStep withImageNames(List imageNames) { + this.imageNames = imageNames; + return this; + } + + /** + * Get the isPushEnabled property: The value of this property indicates whether the image built should be pushed to + * the registry or not. + * + * @return the isPushEnabled value. + */ + public Boolean isPushEnabled() { + return this.isPushEnabled; + } + + /** + * Set the isPushEnabled property: The value of this property indicates whether the image built should be pushed to + * the registry or not. + * + * @param isPushEnabled the isPushEnabled value to set. + * @return the DockerBuildStep object itself. + */ + public DockerBuildStep withIsPushEnabled(Boolean isPushEnabled) { + this.isPushEnabled = isPushEnabled; + return this; + } + + /** + * Get the noCache property: The value of this property indicates whether the image cache is enabled or not. + * + * @return the noCache value. + */ + public Boolean noCache() { + return this.noCache; + } + + /** + * Set the noCache property: The value of this property indicates whether the image cache is enabled or not. + * + * @param noCache the noCache value to set. + * @return the DockerBuildStep object itself. + */ + public DockerBuildStep withNoCache(Boolean noCache) { + this.noCache = noCache; + return this; + } + + /** + * Get the dockerFilePath property: The Docker file path relative to the source context. + * + * @return the dockerFilePath value. + */ + public String dockerFilePath() { + return this.dockerFilePath; + } + + /** + * Set the dockerFilePath property: The Docker file path relative to the source context. + * + * @param dockerFilePath the dockerFilePath value to set. + * @return the DockerBuildStep object itself. + */ + public DockerBuildStep withDockerFilePath(String dockerFilePath) { + this.dockerFilePath = dockerFilePath; + return this; + } + + /** + * Get the target property: The name of the target build stage for the docker build. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The name of the target build stage for the docker build. + * + * @param target the target value to set. + * @return the DockerBuildStep object itself. + */ + public DockerBuildStep withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the arguments property: The collection of override arguments to be used when executing this build step. + * + * @return the arguments value. + */ + public List arguments() { + return this.arguments; + } + + /** + * Set the arguments property: The collection of override arguments to be used when executing this build step. + * + * @param arguments the arguments value to set. + * @return the DockerBuildStep object itself. + */ + public DockerBuildStep withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildStep withContextPath(String contextPath) { + super.withContextPath(contextPath); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildStep withContextAccessToken(String contextAccessToken) { + super.withContextAccessToken(contextAccessToken); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", contextPath()); + jsonWriter.writeStringField("contextAccessToken", contextAccessToken()); + jsonWriter.writeStringField("dockerFilePath", this.dockerFilePath); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeArrayField("imageNames", this.imageNames, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isPushEnabled", this.isPushEnabled); + jsonWriter.writeBooleanField("noCache", this.noCache); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeArrayField("arguments", this.arguments, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DockerBuildStep from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DockerBuildStep if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DockerBuildStep. + */ + public static DockerBuildStep fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DockerBuildStep deserializedDockerBuildStep = new DockerBuildStep(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("baseImageDependencies".equals(fieldName)) { + List baseImageDependencies + = reader.readArray(reader1 -> BaseImageDependency.fromJson(reader1)); + deserializedDockerBuildStep.withBaseImageDependencies(baseImageDependencies); + } else if ("contextPath".equals(fieldName)) { + deserializedDockerBuildStep.withContextPath(reader.getString()); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedDockerBuildStep.withContextAccessToken(reader.getString()); + } else if ("dockerFilePath".equals(fieldName)) { + deserializedDockerBuildStep.dockerFilePath = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDockerBuildStep.type = StepType.fromString(reader.getString()); + } else if ("imageNames".equals(fieldName)) { + List imageNames = reader.readArray(reader1 -> reader1.getString()); + deserializedDockerBuildStep.imageNames = imageNames; + } else if ("isPushEnabled".equals(fieldName)) { + deserializedDockerBuildStep.isPushEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("noCache".equals(fieldName)) { + deserializedDockerBuildStep.noCache = reader.getNullable(JsonReader::getBoolean); + } else if ("target".equals(fieldName)) { + deserializedDockerBuildStep.target = reader.getString(); + } else if ("arguments".equals(fieldName)) { + List arguments = reader.readArray(reader1 -> Argument.fromJson(reader1)); + deserializedDockerBuildStep.arguments = arguments; + } else { + reader.skipChildren(); + } + } + + return deserializedDockerBuildStep; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStepUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStepUpdateParameters.java new file mode 100644 index 000000000000..1a92484ddd77 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStepUpdateParameters.java @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties for updating a docker build step. + */ +@Fluent +public final class DockerBuildStepUpdateParameters extends TaskStepUpdateParameters { + /* + * The type of the step. + */ + private StepType type = StepType.DOCKER; + + /* + * The fully qualified image names including the repository and tag. + */ + private List imageNames; + + /* + * The value of this property indicates whether the image built should be pushed to the registry or not. + */ + private Boolean isPushEnabled; + + /* + * The value of this property indicates whether the image cache is enabled or not. + */ + private Boolean noCache; + + /* + * The Docker file path relative to the source context. + */ + private String dockerFilePath; + + /* + * The collection of override arguments to be used when executing this build step. + */ + private List arguments; + + /* + * The name of the target build stage for the docker build. + */ + private String target; + + /** + * Creates an instance of DockerBuildStepUpdateParameters class. + */ + public DockerBuildStepUpdateParameters() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + @Override + public StepType type() { + return this.type; + } + + /** + * Get the imageNames property: The fully qualified image names including the repository and tag. + * + * @return the imageNames value. + */ + public List imageNames() { + return this.imageNames; + } + + /** + * Set the imageNames property: The fully qualified image names including the repository and tag. + * + * @param imageNames the imageNames value to set. + * @return the DockerBuildStepUpdateParameters object itself. + */ + public DockerBuildStepUpdateParameters withImageNames(List imageNames) { + this.imageNames = imageNames; + return this; + } + + /** + * Get the isPushEnabled property: The value of this property indicates whether the image built should be pushed to + * the registry or not. + * + * @return the isPushEnabled value. + */ + public Boolean isPushEnabled() { + return this.isPushEnabled; + } + + /** + * Set the isPushEnabled property: The value of this property indicates whether the image built should be pushed to + * the registry or not. + * + * @param isPushEnabled the isPushEnabled value to set. + * @return the DockerBuildStepUpdateParameters object itself. + */ + public DockerBuildStepUpdateParameters withIsPushEnabled(Boolean isPushEnabled) { + this.isPushEnabled = isPushEnabled; + return this; + } + + /** + * Get the noCache property: The value of this property indicates whether the image cache is enabled or not. + * + * @return the noCache value. + */ + public Boolean noCache() { + return this.noCache; + } + + /** + * Set the noCache property: The value of this property indicates whether the image cache is enabled or not. + * + * @param noCache the noCache value to set. + * @return the DockerBuildStepUpdateParameters object itself. + */ + public DockerBuildStepUpdateParameters withNoCache(Boolean noCache) { + this.noCache = noCache; + return this; + } + + /** + * Get the dockerFilePath property: The Docker file path relative to the source context. + * + * @return the dockerFilePath value. + */ + public String dockerFilePath() { + return this.dockerFilePath; + } + + /** + * Set the dockerFilePath property: The Docker file path relative to the source context. + * + * @param dockerFilePath the dockerFilePath value to set. + * @return the DockerBuildStepUpdateParameters object itself. + */ + public DockerBuildStepUpdateParameters withDockerFilePath(String dockerFilePath) { + this.dockerFilePath = dockerFilePath; + return this; + } + + /** + * Get the arguments property: The collection of override arguments to be used when executing this build step. + * + * @return the arguments value. + */ + public List arguments() { + return this.arguments; + } + + /** + * Set the arguments property: The collection of override arguments to be used when executing this build step. + * + * @param arguments the arguments value to set. + * @return the DockerBuildStepUpdateParameters object itself. + */ + public DockerBuildStepUpdateParameters withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the target property: The name of the target build stage for the docker build. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The name of the target build stage for the docker build. + * + * @param target the target value to set. + * @return the DockerBuildStepUpdateParameters object itself. + */ + public DockerBuildStepUpdateParameters withTarget(String target) { + this.target = target; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildStepUpdateParameters withContextPath(String contextPath) { + super.withContextPath(contextPath); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DockerBuildStepUpdateParameters withContextAccessToken(String contextAccessToken) { + super.withContextAccessToken(contextAccessToken); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", contextPath()); + jsonWriter.writeStringField("contextAccessToken", contextAccessToken()); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeArrayField("imageNames", this.imageNames, (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("isPushEnabled", this.isPushEnabled); + jsonWriter.writeBooleanField("noCache", this.noCache); + jsonWriter.writeStringField("dockerFilePath", this.dockerFilePath); + jsonWriter.writeArrayField("arguments", this.arguments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("target", this.target); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DockerBuildStepUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DockerBuildStepUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the DockerBuildStepUpdateParameters. + */ + public static DockerBuildStepUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DockerBuildStepUpdateParameters deserializedDockerBuildStepUpdateParameters + = new DockerBuildStepUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contextPath".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.withContextPath(reader.getString()); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.withContextAccessToken(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.type = StepType.fromString(reader.getString()); + } else if ("imageNames".equals(fieldName)) { + List imageNames = reader.readArray(reader1 -> reader1.getString()); + deserializedDockerBuildStepUpdateParameters.imageNames = imageNames; + } else if ("isPushEnabled".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.isPushEnabled + = reader.getNullable(JsonReader::getBoolean); + } else if ("noCache".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.noCache = reader.getNullable(JsonReader::getBoolean); + } else if ("dockerFilePath".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.dockerFilePath = reader.getString(); + } else if ("arguments".equals(fieldName)) { + List arguments = reader.readArray(reader1 -> Argument.fromJson(reader1)); + deserializedDockerBuildStepUpdateParameters.arguments = arguments; + } else if ("target".equals(fieldName)) { + deserializedDockerBuildStepUpdateParameters.target = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDockerBuildStepUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskRunRequest.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskRunRequest.java new file mode 100644 index 000000000000..a7192aa1118c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskRunRequest.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The parameters for a quick task run request. + */ +@Fluent +public final class EncodedTaskRunRequest extends RunRequest { + /* + * The type of the run request. + */ + private String type = "EncodedTaskRunRequest"; + + /* + * Base64 encoded value of the template/definition file content. + */ + private String encodedTaskContent; + + /* + * Base64 encoded value of the parameters/values file content. + */ + private String encodedValuesContent; + + /* + * The collection of overridable values that can be passed when running a task. + */ + private List values; + + /* + * Run timeout in seconds. + */ + private Integer timeout; + + /* + * The platform properties against which the run has to happen. + */ + private PlatformProperties platform; + + /* + * The machine configuration of the run agent. + */ + private AgentProperties agentConfiguration; + + /* + * The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + */ + private String sourceLocation; + + /* + * The properties that describes a set of credentials that will be used when this run is invoked. + */ + private Credentials credentials; + + /** + * Creates an instance of EncodedTaskRunRequest class. + */ + public EncodedTaskRunRequest() { + } + + /** + * Get the type property: The type of the run request. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the encodedTaskContent property: Base64 encoded value of the template/definition file content. + * + * @return the encodedTaskContent value. + */ + public String encodedTaskContent() { + return this.encodedTaskContent; + } + + /** + * Set the encodedTaskContent property: Base64 encoded value of the template/definition file content. + * + * @param encodedTaskContent the encodedTaskContent value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withEncodedTaskContent(String encodedTaskContent) { + this.encodedTaskContent = encodedTaskContent; + return this; + } + + /** + * Get the encodedValuesContent property: Base64 encoded value of the parameters/values file content. + * + * @return the encodedValuesContent value. + */ + public String encodedValuesContent() { + return this.encodedValuesContent; + } + + /** + * Set the encodedValuesContent property: Base64 encoded value of the parameters/values file content. + * + * @param encodedValuesContent the encodedValuesContent value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withEncodedValuesContent(String encodedValuesContent) { + this.encodedValuesContent = encodedValuesContent; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a task. + * + * @param values the values value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the timeout property: Run timeout in seconds. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Run timeout in seconds. + * + * @param timeout the timeout value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the platform property: The platform properties against which the run has to happen. + * + * @return the platform value. + */ + public PlatformProperties platform() { + return this.platform; + } + + /** + * Set the platform property: The platform properties against which the run has to happen. + * + * @param platform the platform value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withPlatform(PlatformProperties platform) { + this.platform = platform; + return this; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.agentConfiguration; + } + + /** + * Set the agentConfiguration property: The machine configuration of the run agent. + * + * @param agentConfiguration the agentConfiguration value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withAgentConfiguration(AgentProperties agentConfiguration) { + this.agentConfiguration = agentConfiguration; + return this; + } + + /** + * Get the sourceLocation property: The URL(absolute or relative) of the source context. It can be an URL to a tar + * or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The URL(absolute or relative) of the source context. It can be an URL to a tar + * or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + * + * @param sourceLocation the sourceLocation value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + /** + * Get the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @return the credentials value. + */ + public Credentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @param credentials the credentials value to set. + * @return the EncodedTaskRunRequest object itself. + */ + public EncodedTaskRunRequest withCredentials(Credentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskRunRequest withIsArchiveEnabled(Boolean isArchiveEnabled) { + super.withIsArchiveEnabled(isArchiveEnabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskRunRequest withAgentPoolName(String agentPoolName) { + super.withAgentPoolName(agentPoolName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskRunRequest withLogTemplate(String logTemplate) { + super.withLogTemplate(logTemplate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("agentPoolName", agentPoolName()); + jsonWriter.writeStringField("logTemplate", logTemplate()); + jsonWriter.writeStringField("encodedTaskContent", this.encodedTaskContent); + jsonWriter.writeJsonField("platform", this.platform); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("encodedValuesContent", this.encodedValuesContent); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("timeout", this.timeout); + jsonWriter.writeJsonField("agentConfiguration", this.agentConfiguration); + jsonWriter.writeStringField("sourceLocation", this.sourceLocation); + jsonWriter.writeJsonField("credentials", this.credentials); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncodedTaskRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncodedTaskRunRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EncodedTaskRunRequest. + */ + public static EncodedTaskRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncodedTaskRunRequest deserializedEncodedTaskRunRequest = new EncodedTaskRunRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isArchiveEnabled".equals(fieldName)) { + deserializedEncodedTaskRunRequest.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("agentPoolName".equals(fieldName)) { + deserializedEncodedTaskRunRequest.withAgentPoolName(reader.getString()); + } else if ("logTemplate".equals(fieldName)) { + deserializedEncodedTaskRunRequest.withLogTemplate(reader.getString()); + } else if ("encodedTaskContent".equals(fieldName)) { + deserializedEncodedTaskRunRequest.encodedTaskContent = reader.getString(); + } else if ("platform".equals(fieldName)) { + deserializedEncodedTaskRunRequest.platform = PlatformProperties.fromJson(reader); + } else if ("type".equals(fieldName)) { + deserializedEncodedTaskRunRequest.type = reader.getString(); + } else if ("encodedValuesContent".equals(fieldName)) { + deserializedEncodedTaskRunRequest.encodedValuesContent = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedEncodedTaskRunRequest.values = values; + } else if ("timeout".equals(fieldName)) { + deserializedEncodedTaskRunRequest.timeout = reader.getNullable(JsonReader::getInt); + } else if ("agentConfiguration".equals(fieldName)) { + deserializedEncodedTaskRunRequest.agentConfiguration = AgentProperties.fromJson(reader); + } else if ("sourceLocation".equals(fieldName)) { + deserializedEncodedTaskRunRequest.sourceLocation = reader.getString(); + } else if ("credentials".equals(fieldName)) { + deserializedEncodedTaskRunRequest.credentials = Credentials.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedEncodedTaskRunRequest; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStep.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStep.java new file mode 100644 index 000000000000..3a3d86894ce1 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStep.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a encoded task step. + */ +@Fluent +public final class EncodedTaskStep extends TaskStepProperties { + /* + * The type of the step. + */ + private StepType type = StepType.ENCODED_TASK; + + /* + * Base64 encoded value of the template/definition file content. + */ + private String encodedTaskContent; + + /* + * Base64 encoded value of the parameters/values file content. + */ + private String encodedValuesContent; + + /* + * The collection of overridable values that can be passed when running a task. + */ + private List values; + + /** + * Creates an instance of EncodedTaskStep class. + */ + public EncodedTaskStep() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + @Override + public StepType type() { + return this.type; + } + + /** + * Get the encodedTaskContent property: Base64 encoded value of the template/definition file content. + * + * @return the encodedTaskContent value. + */ + public String encodedTaskContent() { + return this.encodedTaskContent; + } + + /** + * Set the encodedTaskContent property: Base64 encoded value of the template/definition file content. + * + * @param encodedTaskContent the encodedTaskContent value to set. + * @return the EncodedTaskStep object itself. + */ + public EncodedTaskStep withEncodedTaskContent(String encodedTaskContent) { + this.encodedTaskContent = encodedTaskContent; + return this; + } + + /** + * Get the encodedValuesContent property: Base64 encoded value of the parameters/values file content. + * + * @return the encodedValuesContent value. + */ + public String encodedValuesContent() { + return this.encodedValuesContent; + } + + /** + * Set the encodedValuesContent property: Base64 encoded value of the parameters/values file content. + * + * @param encodedValuesContent the encodedValuesContent value to set. + * @return the EncodedTaskStep object itself. + */ + public EncodedTaskStep withEncodedValuesContent(String encodedValuesContent) { + this.encodedValuesContent = encodedValuesContent; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a task. + * + * @param values the values value to set. + * @return the EncodedTaskStep object itself. + */ + public EncodedTaskStep withValues(List values) { + this.values = values; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskStep withContextPath(String contextPath) { + super.withContextPath(contextPath); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskStep withContextAccessToken(String contextAccessToken) { + super.withContextAccessToken(contextAccessToken); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", contextPath()); + jsonWriter.writeStringField("contextAccessToken", contextAccessToken()); + jsonWriter.writeStringField("encodedTaskContent", this.encodedTaskContent); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("encodedValuesContent", this.encodedValuesContent); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncodedTaskStep from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncodedTaskStep if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EncodedTaskStep. + */ + public static EncodedTaskStep fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncodedTaskStep deserializedEncodedTaskStep = new EncodedTaskStep(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("baseImageDependencies".equals(fieldName)) { + List baseImageDependencies + = reader.readArray(reader1 -> BaseImageDependency.fromJson(reader1)); + deserializedEncodedTaskStep.withBaseImageDependencies(baseImageDependencies); + } else if ("contextPath".equals(fieldName)) { + deserializedEncodedTaskStep.withContextPath(reader.getString()); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedEncodedTaskStep.withContextAccessToken(reader.getString()); + } else if ("encodedTaskContent".equals(fieldName)) { + deserializedEncodedTaskStep.encodedTaskContent = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedEncodedTaskStep.type = StepType.fromString(reader.getString()); + } else if ("encodedValuesContent".equals(fieldName)) { + deserializedEncodedTaskStep.encodedValuesContent = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedEncodedTaskStep.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedEncodedTaskStep; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStepUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStepUpdateParameters.java new file mode 100644 index 000000000000..e35bd21e8496 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStepUpdateParameters.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties for updating encoded task step. + */ +@Fluent +public final class EncodedTaskStepUpdateParameters extends TaskStepUpdateParameters { + /* + * The type of the step. + */ + private StepType type = StepType.ENCODED_TASK; + + /* + * Base64 encoded value of the template/definition file content. + */ + private String encodedTaskContent; + + /* + * Base64 encoded value of the parameters/values file content. + */ + private String encodedValuesContent; + + /* + * The collection of overridable values that can be passed when running a task. + */ + private List values; + + /** + * Creates an instance of EncodedTaskStepUpdateParameters class. + */ + public EncodedTaskStepUpdateParameters() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + @Override + public StepType type() { + return this.type; + } + + /** + * Get the encodedTaskContent property: Base64 encoded value of the template/definition file content. + * + * @return the encodedTaskContent value. + */ + public String encodedTaskContent() { + return this.encodedTaskContent; + } + + /** + * Set the encodedTaskContent property: Base64 encoded value of the template/definition file content. + * + * @param encodedTaskContent the encodedTaskContent value to set. + * @return the EncodedTaskStepUpdateParameters object itself. + */ + public EncodedTaskStepUpdateParameters withEncodedTaskContent(String encodedTaskContent) { + this.encodedTaskContent = encodedTaskContent; + return this; + } + + /** + * Get the encodedValuesContent property: Base64 encoded value of the parameters/values file content. + * + * @return the encodedValuesContent value. + */ + public String encodedValuesContent() { + return this.encodedValuesContent; + } + + /** + * Set the encodedValuesContent property: Base64 encoded value of the parameters/values file content. + * + * @param encodedValuesContent the encodedValuesContent value to set. + * @return the EncodedTaskStepUpdateParameters object itself. + */ + public EncodedTaskStepUpdateParameters withEncodedValuesContent(String encodedValuesContent) { + this.encodedValuesContent = encodedValuesContent; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a task. + * + * @param values the values value to set. + * @return the EncodedTaskStepUpdateParameters object itself. + */ + public EncodedTaskStepUpdateParameters withValues(List values) { + this.values = values; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskStepUpdateParameters withContextPath(String contextPath) { + super.withContextPath(contextPath); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public EncodedTaskStepUpdateParameters withContextAccessToken(String contextAccessToken) { + super.withContextAccessToken(contextAccessToken); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", contextPath()); + jsonWriter.writeStringField("contextAccessToken", contextAccessToken()); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("encodedTaskContent", this.encodedTaskContent); + jsonWriter.writeStringField("encodedValuesContent", this.encodedValuesContent); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncodedTaskStepUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncodedTaskStepUpdateParameters if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EncodedTaskStepUpdateParameters. + */ + public static EncodedTaskStepUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncodedTaskStepUpdateParameters deserializedEncodedTaskStepUpdateParameters + = new EncodedTaskStepUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contextPath".equals(fieldName)) { + deserializedEncodedTaskStepUpdateParameters.withContextPath(reader.getString()); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedEncodedTaskStepUpdateParameters.withContextAccessToken(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedEncodedTaskStepUpdateParameters.type = StepType.fromString(reader.getString()); + } else if ("encodedTaskContent".equals(fieldName)) { + deserializedEncodedTaskStepUpdateParameters.encodedTaskContent = reader.getString(); + } else if ("encodedValuesContent".equals(fieldName)) { + deserializedEncodedTaskStepUpdateParameters.encodedValuesContent = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedEncodedTaskStepUpdateParameters.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedEncodedTaskStepUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskRunRequest.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskRunRequest.java new file mode 100644 index 000000000000..898c2384e2e6 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskRunRequest.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The request parameters for a scheduling run against a task file. + */ +@Fluent +public final class FileTaskRunRequest extends RunRequest { + /* + * The type of the run request. + */ + private String type = "FileTaskRunRequest"; + + /* + * The template/definition file path relative to the source. + */ + private String taskFilePath; + + /* + * The values/parameters file path relative to the source. + */ + private String valuesFilePath; + + /* + * The collection of overridable values that can be passed when running a task. + */ + private List values; + + /* + * Run timeout in seconds. + */ + private Integer timeout; + + /* + * The platform properties against which the run has to happen. + */ + private PlatformProperties platform; + + /* + * The machine configuration of the run agent. + */ + private AgentProperties agentConfiguration; + + /* + * The URL(absolute or relative) of the source context. It can be an URL to a tar or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + */ + private String sourceLocation; + + /* + * The properties that describes a set of credentials that will be used when this run is invoked. + */ + private Credentials credentials; + + /** + * Creates an instance of FileTaskRunRequest class. + */ + public FileTaskRunRequest() { + } + + /** + * Get the type property: The type of the run request. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the taskFilePath property: The template/definition file path relative to the source. + * + * @return the taskFilePath value. + */ + public String taskFilePath() { + return this.taskFilePath; + } + + /** + * Set the taskFilePath property: The template/definition file path relative to the source. + * + * @param taskFilePath the taskFilePath value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withTaskFilePath(String taskFilePath) { + this.taskFilePath = taskFilePath; + return this; + } + + /** + * Get the valuesFilePath property: The values/parameters file path relative to the source. + * + * @return the valuesFilePath value. + */ + public String valuesFilePath() { + return this.valuesFilePath; + } + + /** + * Set the valuesFilePath property: The values/parameters file path relative to the source. + * + * @param valuesFilePath the valuesFilePath value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withValuesFilePath(String valuesFilePath) { + this.valuesFilePath = valuesFilePath; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a task. + * + * @param values the values value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the timeout property: Run timeout in seconds. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Run timeout in seconds. + * + * @param timeout the timeout value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the platform property: The platform properties against which the run has to happen. + * + * @return the platform value. + */ + public PlatformProperties platform() { + return this.platform; + } + + /** + * Set the platform property: The platform properties against which the run has to happen. + * + * @param platform the platform value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withPlatform(PlatformProperties platform) { + this.platform = platform; + return this; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.agentConfiguration; + } + + /** + * Set the agentConfiguration property: The machine configuration of the run agent. + * + * @param agentConfiguration the agentConfiguration value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withAgentConfiguration(AgentProperties agentConfiguration) { + this.agentConfiguration = agentConfiguration; + return this; + } + + /** + * Get the sourceLocation property: The URL(absolute or relative) of the source context. It can be an URL to a tar + * or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + * + * @return the sourceLocation value. + */ + public String sourceLocation() { + return this.sourceLocation; + } + + /** + * Set the sourceLocation property: The URL(absolute or relative) of the source context. It can be an URL to a tar + * or git repository. + * If it is relative URL, the relative path should be obtained from calling listBuildSourceUploadUrl API. + * + * @param sourceLocation the sourceLocation value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withSourceLocation(String sourceLocation) { + this.sourceLocation = sourceLocation; + return this; + } + + /** + * Get the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @return the credentials value. + */ + public Credentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @param credentials the credentials value to set. + * @return the FileTaskRunRequest object itself. + */ + public FileTaskRunRequest withCredentials(Credentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskRunRequest withIsArchiveEnabled(Boolean isArchiveEnabled) { + super.withIsArchiveEnabled(isArchiveEnabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskRunRequest withAgentPoolName(String agentPoolName) { + super.withAgentPoolName(agentPoolName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskRunRequest withLogTemplate(String logTemplate) { + super.withLogTemplate(logTemplate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("agentPoolName", agentPoolName()); + jsonWriter.writeStringField("logTemplate", logTemplate()); + jsonWriter.writeStringField("taskFilePath", this.taskFilePath); + jsonWriter.writeJsonField("platform", this.platform); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("valuesFilePath", this.valuesFilePath); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeNumberField("timeout", this.timeout); + jsonWriter.writeJsonField("agentConfiguration", this.agentConfiguration); + jsonWriter.writeStringField("sourceLocation", this.sourceLocation); + jsonWriter.writeJsonField("credentials", this.credentials); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileTaskRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileTaskRunRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileTaskRunRequest. + */ + public static FileTaskRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileTaskRunRequest deserializedFileTaskRunRequest = new FileTaskRunRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isArchiveEnabled".equals(fieldName)) { + deserializedFileTaskRunRequest.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("agentPoolName".equals(fieldName)) { + deserializedFileTaskRunRequest.withAgentPoolName(reader.getString()); + } else if ("logTemplate".equals(fieldName)) { + deserializedFileTaskRunRequest.withLogTemplate(reader.getString()); + } else if ("taskFilePath".equals(fieldName)) { + deserializedFileTaskRunRequest.taskFilePath = reader.getString(); + } else if ("platform".equals(fieldName)) { + deserializedFileTaskRunRequest.platform = PlatformProperties.fromJson(reader); + } else if ("type".equals(fieldName)) { + deserializedFileTaskRunRequest.type = reader.getString(); + } else if ("valuesFilePath".equals(fieldName)) { + deserializedFileTaskRunRequest.valuesFilePath = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedFileTaskRunRequest.values = values; + } else if ("timeout".equals(fieldName)) { + deserializedFileTaskRunRequest.timeout = reader.getNullable(JsonReader::getInt); + } else if ("agentConfiguration".equals(fieldName)) { + deserializedFileTaskRunRequest.agentConfiguration = AgentProperties.fromJson(reader); + } else if ("sourceLocation".equals(fieldName)) { + deserializedFileTaskRunRequest.sourceLocation = reader.getString(); + } else if ("credentials".equals(fieldName)) { + deserializedFileTaskRunRequest.credentials = Credentials.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFileTaskRunRequest; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStep.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStep.java new file mode 100644 index 000000000000..a03324d2fe28 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStep.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a task step. + */ +@Fluent +public final class FileTaskStep extends TaskStepProperties { + /* + * The type of the step. + */ + private StepType type = StepType.FILE_TASK; + + /* + * The task template/definition file path relative to the source context. + */ + private String taskFilePath; + + /* + * The task values/parameters file path relative to the source context. + */ + private String valuesFilePath; + + /* + * The collection of overridable values that can be passed when running a task. + */ + private List values; + + /** + * Creates an instance of FileTaskStep class. + */ + public FileTaskStep() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + @Override + public StepType type() { + return this.type; + } + + /** + * Get the taskFilePath property: The task template/definition file path relative to the source context. + * + * @return the taskFilePath value. + */ + public String taskFilePath() { + return this.taskFilePath; + } + + /** + * Set the taskFilePath property: The task template/definition file path relative to the source context. + * + * @param taskFilePath the taskFilePath value to set. + * @return the FileTaskStep object itself. + */ + public FileTaskStep withTaskFilePath(String taskFilePath) { + this.taskFilePath = taskFilePath; + return this; + } + + /** + * Get the valuesFilePath property: The task values/parameters file path relative to the source context. + * + * @return the valuesFilePath value. + */ + public String valuesFilePath() { + return this.valuesFilePath; + } + + /** + * Set the valuesFilePath property: The task values/parameters file path relative to the source context. + * + * @param valuesFilePath the valuesFilePath value to set. + * @return the FileTaskStep object itself. + */ + public FileTaskStep withValuesFilePath(String valuesFilePath) { + this.valuesFilePath = valuesFilePath; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a task. + * + * @param values the values value to set. + * @return the FileTaskStep object itself. + */ + public FileTaskStep withValues(List values) { + this.values = values; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskStep withContextPath(String contextPath) { + super.withContextPath(contextPath); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskStep withContextAccessToken(String contextAccessToken) { + super.withContextAccessToken(contextAccessToken); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", contextPath()); + jsonWriter.writeStringField("contextAccessToken", contextAccessToken()); + jsonWriter.writeStringField("taskFilePath", this.taskFilePath); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("valuesFilePath", this.valuesFilePath); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileTaskStep from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileTaskStep if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FileTaskStep. + */ + public static FileTaskStep fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileTaskStep deserializedFileTaskStep = new FileTaskStep(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("baseImageDependencies".equals(fieldName)) { + List baseImageDependencies + = reader.readArray(reader1 -> BaseImageDependency.fromJson(reader1)); + deserializedFileTaskStep.withBaseImageDependencies(baseImageDependencies); + } else if ("contextPath".equals(fieldName)) { + deserializedFileTaskStep.withContextPath(reader.getString()); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedFileTaskStep.withContextAccessToken(reader.getString()); + } else if ("taskFilePath".equals(fieldName)) { + deserializedFileTaskStep.taskFilePath = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFileTaskStep.type = StepType.fromString(reader.getString()); + } else if ("valuesFilePath".equals(fieldName)) { + deserializedFileTaskStep.valuesFilePath = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedFileTaskStep.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedFileTaskStep; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStepUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStepUpdateParameters.java new file mode 100644 index 000000000000..90e4f51c3869 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStepUpdateParameters.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of updating a task step. + */ +@Fluent +public final class FileTaskStepUpdateParameters extends TaskStepUpdateParameters { + /* + * The type of the step. + */ + private StepType type = StepType.FILE_TASK; + + /* + * The task template/definition file path relative to the source context. + */ + private String taskFilePath; + + /* + * The values/parameters file path relative to the source context. + */ + private String valuesFilePath; + + /* + * The collection of overridable values that can be passed when running a task. + */ + private List values; + + /** + * Creates an instance of FileTaskStepUpdateParameters class. + */ + public FileTaskStepUpdateParameters() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + @Override + public StepType type() { + return this.type; + } + + /** + * Get the taskFilePath property: The task template/definition file path relative to the source context. + * + * @return the taskFilePath value. + */ + public String taskFilePath() { + return this.taskFilePath; + } + + /** + * Set the taskFilePath property: The task template/definition file path relative to the source context. + * + * @param taskFilePath the taskFilePath value to set. + * @return the FileTaskStepUpdateParameters object itself. + */ + public FileTaskStepUpdateParameters withTaskFilePath(String taskFilePath) { + this.taskFilePath = taskFilePath; + return this; + } + + /** + * Get the valuesFilePath property: The values/parameters file path relative to the source context. + * + * @return the valuesFilePath value. + */ + public String valuesFilePath() { + return this.valuesFilePath; + } + + /** + * Set the valuesFilePath property: The values/parameters file path relative to the source context. + * + * @param valuesFilePath the valuesFilePath value to set. + * @return the FileTaskStepUpdateParameters object itself. + */ + public FileTaskStepUpdateParameters withValuesFilePath(String valuesFilePath) { + this.valuesFilePath = valuesFilePath; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a task. + * + * @param values the values value to set. + * @return the FileTaskStepUpdateParameters object itself. + */ + public FileTaskStepUpdateParameters withValues(List values) { + this.values = values; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskStepUpdateParameters withContextPath(String contextPath) { + super.withContextPath(contextPath); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public FileTaskStepUpdateParameters withContextAccessToken(String contextAccessToken) { + super.withContextAccessToken(contextAccessToken); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", contextPath()); + jsonWriter.writeStringField("contextAccessToken", contextAccessToken()); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("taskFilePath", this.taskFilePath); + jsonWriter.writeStringField("valuesFilePath", this.valuesFilePath); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FileTaskStepUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FileTaskStepUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the FileTaskStepUpdateParameters. + */ + public static FileTaskStepUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FileTaskStepUpdateParameters deserializedFileTaskStepUpdateParameters = new FileTaskStepUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contextPath".equals(fieldName)) { + deserializedFileTaskStepUpdateParameters.withContextPath(reader.getString()); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedFileTaskStepUpdateParameters.withContextAccessToken(reader.getString()); + } else if ("type".equals(fieldName)) { + deserializedFileTaskStepUpdateParameters.type = StepType.fromString(reader.getString()); + } else if ("taskFilePath".equals(fieldName)) { + deserializedFileTaskStepUpdateParameters.taskFilePath = reader.getString(); + } else if ("valuesFilePath".equals(fieldName)) { + deserializedFileTaskStepUpdateParameters.valuesFilePath = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedFileTaskStepUpdateParameters.values = values; + } else { + reader.skipChildren(); + } + } + + return deserializedFileTaskStepUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/IdentityProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/IdentityProperties.java new file mode 100644 index 000000000000..48500dd7a99d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/IdentityProperties.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed identity for the resource. + */ +@Fluent +public final class IdentityProperties implements JsonSerializable { + /* + * The principal ID of resource identity. + */ + private String principalId; + + /* + * The tenant ID of resource. + */ + private String tenantId; + + /* + * The identity type. + */ + private ResourceIdentityType type; + + /* + * The list of user identities associated with the resource. The user identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + * providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of IdentityProperties class. + */ + public IdentityProperties() { + } + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The identity type. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The identity type. + * + * @param type the type value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + * providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity + * dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/ + * providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the IdentityProperties object itself. + */ + public IdentityProperties withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IdentityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IdentityProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IdentityProperties. + */ + public static IdentityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IdentityProperties deserializedIdentityProperties = new IdentityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedIdentityProperties.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedIdentityProperties.tenantId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIdentityProperties.type = ResourceIdentityType.fromString(reader.getString()); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserIdentityProperties.fromJson(reader1)); + deserializedIdentityProperties.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedIdentityProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageDescriptor.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageDescriptor.java new file mode 100644 index 000000000000..0f78f9a5eb13 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageDescriptor.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties for a registry image. + */ +@Immutable +public final class ImageDescriptor implements JsonSerializable { + /* + * The registry login server. + */ + private String registry; + + /* + * The repository name. + */ + private String repository; + + /* + * The tag name. + */ + private String tag; + + /* + * The sha256-based digest of the image manifest. + */ + private String digest; + + /** + * Creates an instance of ImageDescriptor class. + */ + private ImageDescriptor() { + } + + /** + * Get the registry property: The registry login server. + * + * @return the registry value. + */ + public String registry() { + return this.registry; + } + + /** + * Get the repository property: The repository name. + * + * @return the repository value. + */ + public String repository() { + return this.repository; + } + + /** + * Get the tag property: The tag name. + * + * @return the tag value. + */ + public String tag() { + return this.tag; + } + + /** + * Get the digest property: The sha256-based digest of the image manifest. + * + * @return the digest value. + */ + public String digest() { + return this.digest; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("registry", this.registry); + jsonWriter.writeStringField("repository", this.repository); + jsonWriter.writeStringField("tag", this.tag); + jsonWriter.writeStringField("digest", this.digest); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageDescriptor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageDescriptor if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ImageDescriptor. + */ + public static ImageDescriptor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageDescriptor deserializedImageDescriptor = new ImageDescriptor(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("registry".equals(fieldName)) { + deserializedImageDescriptor.registry = reader.getString(); + } else if ("repository".equals(fieldName)) { + deserializedImageDescriptor.repository = reader.getString(); + } else if ("tag".equals(fieldName)) { + deserializedImageDescriptor.tag = reader.getString(); + } else if ("digest".equals(fieldName)) { + deserializedImageDescriptor.digest = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedImageDescriptor; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageUpdateTrigger.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageUpdateTrigger.java new file mode 100644 index 000000000000..923b75a24427 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageUpdateTrigger.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The image update trigger that caused a build. + */ +@Immutable +public final class ImageUpdateTrigger implements JsonSerializable { + /* + * The unique ID of the trigger. + */ + private String id; + + /* + * The timestamp when the image update happened. + */ + private OffsetDateTime timestamp; + + /* + * The list of image updates that caused the build. + */ + private List images; + + /** + * Creates an instance of ImageUpdateTrigger class. + */ + private ImageUpdateTrigger() { + } + + /** + * Get the id property: The unique ID of the trigger. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the timestamp property: The timestamp when the image update happened. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Get the images property: The list of image updates that caused the build. + * + * @return the images value. + */ + public List images() { + return this.images; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("timestamp", + this.timestamp == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.timestamp)); + jsonWriter.writeArrayField("images", this.images, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ImageUpdateTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ImageUpdateTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ImageUpdateTrigger. + */ + public static ImageUpdateTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ImageUpdateTrigger deserializedImageUpdateTrigger = new ImageUpdateTrigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedImageUpdateTrigger.id = reader.getString(); + } else if ("timestamp".equals(fieldName)) { + deserializedImageUpdateTrigger.timestamp = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("images".equals(fieldName)) { + List images = reader.readArray(reader1 -> ImageDescriptor.fromJson(reader1)); + deserializedImageUpdateTrigger.images = images; + } else { + reader.skipChildren(); + } + } + + return deserializedImageUpdateTrigger; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OS.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OS.java new file mode 100644 index 000000000000..8a3b8f83df3d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OS.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The OS of agent machine. + */ +public final class OS extends ExpandableStringEnum { + /** + * Static value Windows for OS. + */ + public static final OS WINDOWS = fromString("Windows"); + + /** + * Static value Linux for OS. + */ + public static final OS LINUX = fromString("Linux"); + + /** + * Creates a new instance of OS value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OS() { + } + + /** + * Creates or finds a OS from its string representation. + * + * @param name a name to look for. + * @return the corresponding OS. + */ + public static OS fromString(String name) { + return fromString(name, OS.class); + } + + /** + * Gets known OS values. + * + * @return known OS values. + */ + public static Collection values() { + return values(OS.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OverrideTaskStepProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OverrideTaskStepProperties.java new file mode 100644 index 000000000000..b2b27635dbf3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OverrideTaskStepProperties.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The OverrideTaskStepProperties model. + */ +@Fluent +public final class OverrideTaskStepProperties implements JsonSerializable { + /* + * The source context against which run has to be queued. + */ + private String contextPath; + + /* + * The file against which run has to be queued. + */ + private String file; + + /* + * Gets or sets the collection of override arguments to be used when + * executing a build step. + */ + private List arguments; + + /* + * The name of the target build stage for the docker build. + */ + private String target; + + /* + * The collection of overridable values that can be passed when running a Task. + */ + private List values; + + /* + * Base64 encoded update trigger token that will be attached with the base image trigger webhook. + */ + private String updateTriggerToken; + + /** + * Creates an instance of OverrideTaskStepProperties class. + */ + public OverrideTaskStepProperties() { + } + + /** + * Get the contextPath property: The source context against which run has to be queued. + * + * @return the contextPath value. + */ + public String contextPath() { + return this.contextPath; + } + + /** + * Set the contextPath property: The source context against which run has to be queued. + * + * @param contextPath the contextPath value to set. + * @return the OverrideTaskStepProperties object itself. + */ + public OverrideTaskStepProperties withContextPath(String contextPath) { + this.contextPath = contextPath; + return this; + } + + /** + * Get the file property: The file against which run has to be queued. + * + * @return the file value. + */ + public String file() { + return this.file; + } + + /** + * Set the file property: The file against which run has to be queued. + * + * @param file the file value to set. + * @return the OverrideTaskStepProperties object itself. + */ + public OverrideTaskStepProperties withFile(String file) { + this.file = file; + return this; + } + + /** + * Get the arguments property: Gets or sets the collection of override arguments to be used when + * executing a build step. + * + * @return the arguments value. + */ + public List arguments() { + return this.arguments; + } + + /** + * Set the arguments property: Gets or sets the collection of override arguments to be used when + * executing a build step. + * + * @param arguments the arguments value to set. + * @return the OverrideTaskStepProperties object itself. + */ + public OverrideTaskStepProperties withArguments(List arguments) { + this.arguments = arguments; + return this; + } + + /** + * Get the target property: The name of the target build stage for the docker build. + * + * @return the target value. + */ + public String target() { + return this.target; + } + + /** + * Set the target property: The name of the target build stage for the docker build. + * + * @param target the target value to set. + * @return the OverrideTaskStepProperties object itself. + */ + public OverrideTaskStepProperties withTarget(String target) { + this.target = target; + return this; + } + + /** + * Get the values property: The collection of overridable values that can be passed when running a Task. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: The collection of overridable values that can be passed when running a Task. + * + * @param values the values value to set. + * @return the OverrideTaskStepProperties object itself. + */ + public OverrideTaskStepProperties withValues(List values) { + this.values = values; + return this; + } + + /** + * Get the updateTriggerToken property: Base64 encoded update trigger token that will be attached with the base + * image trigger webhook. + * + * @return the updateTriggerToken value. + */ + public String updateTriggerToken() { + return this.updateTriggerToken; + } + + /** + * Set the updateTriggerToken property: Base64 encoded update trigger token that will be attached with the base + * image trigger webhook. + * + * @param updateTriggerToken the updateTriggerToken value to set. + * @return the OverrideTaskStepProperties object itself. + */ + public OverrideTaskStepProperties withUpdateTriggerToken(String updateTriggerToken) { + this.updateTriggerToken = updateTriggerToken; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("contextPath", this.contextPath); + jsonWriter.writeStringField("file", this.file); + jsonWriter.writeArrayField("arguments", this.arguments, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("target", this.target); + jsonWriter.writeArrayField("values", this.values, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("updateTriggerToken", this.updateTriggerToken); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OverrideTaskStepProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OverrideTaskStepProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OverrideTaskStepProperties. + */ + public static OverrideTaskStepProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OverrideTaskStepProperties deserializedOverrideTaskStepProperties = new OverrideTaskStepProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("contextPath".equals(fieldName)) { + deserializedOverrideTaskStepProperties.contextPath = reader.getString(); + } else if ("file".equals(fieldName)) { + deserializedOverrideTaskStepProperties.file = reader.getString(); + } else if ("arguments".equals(fieldName)) { + List arguments = reader.readArray(reader1 -> Argument.fromJson(reader1)); + deserializedOverrideTaskStepProperties.arguments = arguments; + } else if ("target".equals(fieldName)) { + deserializedOverrideTaskStepProperties.target = reader.getString(); + } else if ("values".equals(fieldName)) { + List values = reader.readArray(reader1 -> SetValue.fromJson(reader1)); + deserializedOverrideTaskStepProperties.values = values; + } else if ("updateTriggerToken".equals(fieldName)) { + deserializedOverrideTaskStepProperties.updateTriggerToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOverrideTaskStepProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformProperties.java new file mode 100644 index 000000000000..5ad9d22047cd --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The platform properties against which the run has to happen. + */ +@Fluent +public final class PlatformProperties implements JsonSerializable { + /* + * The operating system type required for the run. + */ + private OS os; + + /* + * The OS architecture. + */ + private Architecture architecture; + + /* + * Variant of the CPU. + */ + private Variant variant; + + /** + * Creates an instance of PlatformProperties class. + */ + public PlatformProperties() { + } + + /** + * Get the os property: The operating system type required for the run. + * + * @return the os value. + */ + public OS os() { + return this.os; + } + + /** + * Set the os property: The operating system type required for the run. + * + * @param os the os value to set. + * @return the PlatformProperties object itself. + */ + public PlatformProperties withOs(OS os) { + this.os = os; + return this; + } + + /** + * Get the architecture property: The OS architecture. + * + * @return the architecture value. + */ + public Architecture architecture() { + return this.architecture; + } + + /** + * Set the architecture property: The OS architecture. + * + * @param architecture the architecture value to set. + * @return the PlatformProperties object itself. + */ + public PlatformProperties withArchitecture(Architecture architecture) { + this.architecture = architecture; + return this; + } + + /** + * Get the variant property: Variant of the CPU. + * + * @return the variant value. + */ + public Variant variant() { + return this.variant; + } + + /** + * Set the variant property: Variant of the CPU. + * + * @param variant the variant value to set. + * @return the PlatformProperties object itself. + */ + public PlatformProperties withVariant(Variant variant) { + this.variant = variant; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("os", this.os == null ? null : this.os.toString()); + jsonWriter.writeStringField("architecture", this.architecture == null ? null : this.architecture.toString()); + jsonWriter.writeStringField("variant", this.variant == null ? null : this.variant.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlatformProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlatformProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PlatformProperties. + */ + public static PlatformProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlatformProperties deserializedPlatformProperties = new PlatformProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("os".equals(fieldName)) { + deserializedPlatformProperties.os = OS.fromString(reader.getString()); + } else if ("architecture".equals(fieldName)) { + deserializedPlatformProperties.architecture = Architecture.fromString(reader.getString()); + } else if ("variant".equals(fieldName)) { + deserializedPlatformProperties.variant = Variant.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPlatformProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformUpdateParameters.java new file mode 100644 index 000000000000..c6451b9723ec --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformUpdateParameters.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties for updating the platform configuration. + */ +@Fluent +public final class PlatformUpdateParameters implements JsonSerializable { + /* + * The operating system type required for the run. + */ + private OS os; + + /* + * The OS architecture. + */ + private Architecture architecture; + + /* + * Variant of the CPU. + */ + private Variant variant; + + /** + * Creates an instance of PlatformUpdateParameters class. + */ + public PlatformUpdateParameters() { + } + + /** + * Get the os property: The operating system type required for the run. + * + * @return the os value. + */ + public OS os() { + return this.os; + } + + /** + * Set the os property: The operating system type required for the run. + * + * @param os the os value to set. + * @return the PlatformUpdateParameters object itself. + */ + public PlatformUpdateParameters withOs(OS os) { + this.os = os; + return this; + } + + /** + * Get the architecture property: The OS architecture. + * + * @return the architecture value. + */ + public Architecture architecture() { + return this.architecture; + } + + /** + * Set the architecture property: The OS architecture. + * + * @param architecture the architecture value to set. + * @return the PlatformUpdateParameters object itself. + */ + public PlatformUpdateParameters withArchitecture(Architecture architecture) { + this.architecture = architecture; + return this; + } + + /** + * Get the variant property: Variant of the CPU. + * + * @return the variant value. + */ + public Variant variant() { + return this.variant; + } + + /** + * Set the variant property: Variant of the CPU. + * + * @param variant the variant value to set. + * @return the PlatformUpdateParameters object itself. + */ + public PlatformUpdateParameters withVariant(Variant variant) { + this.variant = variant; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("os", this.os == null ? null : this.os.toString()); + jsonWriter.writeStringField("architecture", this.architecture == null ? null : this.architecture.toString()); + jsonWriter.writeStringField("variant", this.variant == null ? null : this.variant.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PlatformUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PlatformUpdateParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PlatformUpdateParameters. + */ + public static PlatformUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PlatformUpdateParameters deserializedPlatformUpdateParameters = new PlatformUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("os".equals(fieldName)) { + deserializedPlatformUpdateParameters.os = OS.fromString(reader.getString()); + } else if ("architecture".equals(fieldName)) { + deserializedPlatformUpdateParameters.architecture = Architecture.fromString(reader.getString()); + } else if ("variant".equals(fieldName)) { + deserializedPlatformUpdateParameters.variant = Variant.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPlatformUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ProvisioningState.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ProvisioningState.java new file mode 100644 index 000000000000..44aacae6025c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ProvisioningState.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of this agent pool. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Static value Creating for ProvisioningState. + */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** + * Static value Updating for ProvisioningState. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Static value Deleting for ProvisioningState. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Static value Succeeded for ProvisioningState. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ProvisioningState. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ProvisioningState. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Registries.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Registries.java new file mode 100644 index 000000000000..22727c713174 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Registries.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Registries. + */ +public interface Registries { + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties along with {@link Response}. + */ + Response scheduleRunWithResponse(String resourceGroupName, String registryName, RunRequest runRequest, + Context context); + + /** + * Schedules a new run based on the request parameters and add it to the run queue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @param runRequest The request body. + * @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 run resource properties. + */ + Run scheduleRun(String resourceGroupName, String registryName, RunRequest runRequest); + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source along with {@link Response}. + */ + Response getBuildSourceUploadUrlWithResponse(String resourceGroupName, String registryName, + Context context); + + /** + * Get the upload location for the user to be able to upload the source. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the container registry. + * @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 upload location for the user to be able to upload the source. + */ + SourceUploadDefinition getBuildSourceUploadUrl(String resourceGroupName, String registryName); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ResourceIdentityType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ResourceIdentityType.java new file mode 100644 index 000000000000..1500d24b1d03 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ResourceIdentityType.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +/** + * The identity type. + */ +public enum ResourceIdentityType { + /** + * Enum value SystemAssigned. + */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** + * Enum value UserAssigned. + */ + USER_ASSIGNED("UserAssigned"), + + /** + * Enum value SystemAssigned, UserAssigned. + */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, UserAssigned"), + + /** + * Enum value None. + */ + NONE("None"); + + /** + * The actual serialized value for a ResourceIdentityType instance. + */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + public static ResourceIdentityType fromString(String value) { + if (value == null) { + return null; + } + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** + * {@inheritDoc} + */ + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Run.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Run.java new file mode 100644 index 000000000000..d6f9d0d2e098 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Run.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner; + +/** + * An immutable client-side representation of Run. + */ +public interface Run { + /** + * 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 properties property: The properties of a run. + * + * @return the properties value. + */ + RunProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner object. + * + * @return the inner object. + */ + RunInner innerModel(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunGetLogResult.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunGetLogResult.java new file mode 100644 index 000000000000..751b7897123c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunGetLogResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner; + +/** + * An immutable client-side representation of RunGetLogResult. + */ +public interface RunGetLogResult { + /** + * Gets the logLink property: The link to logs for a run on a azure container registry. + * + * @return the logLink value. + */ + String logLink(); + + /** + * Gets the logArtifactLink property: The link to logs in registry for a run on a azure container registry. + * + * @return the logArtifactLink value. + */ + String logArtifactLink(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner object. + * + * @return the inner object. + */ + RunGetLogResultInner innerModel(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunProperties.java new file mode 100644 index 000000000000..4f1ae1b056c9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunProperties.java @@ -0,0 +1,449 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; +import java.util.List; + +/** + * The properties for a run. + */ +@Immutable +public final class RunProperties implements JsonSerializable { + /* + * The unique identifier for the run. + */ + private String runId; + + /* + * The current status of the run. + */ + private RunStatus status; + + /* + * The last updated time for the run. + */ + private OffsetDateTime lastUpdatedTime; + + /* + * The type of run. + */ + private RunType runType; + + /* + * The dedicated agent pool for the run. + */ + private String agentPoolName; + + /* + * The time the run was scheduled. + */ + private OffsetDateTime createTime; + + /* + * The time the run started. + */ + private OffsetDateTime startTime; + + /* + * The time the run finished. + */ + private OffsetDateTime finishTime; + + /* + * The list of all images that were generated from the run. This is applicable if the run generates base image + * dependencies. + */ + private List outputImages; + + /* + * The task against which run was scheduled. + */ + private String task; + + /* + * The image update trigger that caused the run. This is applicable if the task has base image trigger configured. + */ + private ImageUpdateTrigger imageUpdateTrigger; + + /* + * The source trigger that caused the run. + */ + private SourceTriggerDescriptor sourceTrigger; + + /* + * The timer trigger that caused the run. + */ + private TimerTriggerDescriptor timerTrigger; + + /* + * The platform properties against which the run will happen. + */ + private PlatformProperties platform; + + /* + * The machine configuration of the run agent. + */ + private AgentProperties agentConfiguration; + + /* + * The scope of the credentials that were used to login to the source registry during this run. + */ + private String sourceRegistryAuth; + + /* + * The list of custom registries that were logged in during this run. + */ + private List customRegistries; + + /* + * The error message received from backend systems after the run is scheduled. + */ + private String runErrorMessage; + + /* + * The update trigger token passed for the Run. + */ + private String updateTriggerToken; + + /* + * The image description for the log artifact. + */ + private ImageDescriptor logArtifact; + + /* + * The provisioning state of a run. + */ + private ProvisioningState provisioningState; + + /* + * The value that indicates whether archiving is enabled or not. + */ + private Boolean isArchiveEnabled; + + /** + * Creates an instance of RunProperties class. + */ + private RunProperties() { + } + + /** + * Get the runId property: The unique identifier for the run. + * + * @return the runId value. + */ + public String runId() { + return this.runId; + } + + /** + * Get the status property: The current status of the run. + * + * @return the status value. + */ + public RunStatus status() { + return this.status; + } + + /** + * Get the lastUpdatedTime property: The last updated time for the run. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the runType property: The type of run. + * + * @return the runType value. + */ + public RunType runType() { + return this.runType; + } + + /** + * Get the agentPoolName property: The dedicated agent pool for the run. + * + * @return the agentPoolName value. + */ + public String agentPoolName() { + return this.agentPoolName; + } + + /** + * Get the createTime property: The time the run was scheduled. + * + * @return the createTime value. + */ + public OffsetDateTime createTime() { + return this.createTime; + } + + /** + * Get the startTime property: The time the run started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the finishTime property: The time the run finished. + * + * @return the finishTime value. + */ + public OffsetDateTime finishTime() { + return this.finishTime; + } + + /** + * Get the outputImages property: The list of all images that were generated from the run. This is applicable if the + * run generates base image dependencies. + * + * @return the outputImages value. + */ + public List outputImages() { + return this.outputImages; + } + + /** + * Get the task property: The task against which run was scheduled. + * + * @return the task value. + */ + public String task() { + return this.task; + } + + /** + * Get the imageUpdateTrigger property: The image update trigger that caused the run. This is applicable if the task + * has base image trigger configured. + * + * @return the imageUpdateTrigger value. + */ + public ImageUpdateTrigger imageUpdateTrigger() { + return this.imageUpdateTrigger; + } + + /** + * Get the sourceTrigger property: The source trigger that caused the run. + * + * @return the sourceTrigger value. + */ + public SourceTriggerDescriptor sourceTrigger() { + return this.sourceTrigger; + } + + /** + * Get the timerTrigger property: The timer trigger that caused the run. + * + * @return the timerTrigger value. + */ + public TimerTriggerDescriptor timerTrigger() { + return this.timerTrigger; + } + + /** + * Get the platform property: The platform properties against which the run will happen. + * + * @return the platform value. + */ + public PlatformProperties platform() { + return this.platform; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.agentConfiguration; + } + + /** + * Get the sourceRegistryAuth property: The scope of the credentials that were used to login to the source registry + * during this run. + * + * @return the sourceRegistryAuth value. + */ + public String sourceRegistryAuth() { + return this.sourceRegistryAuth; + } + + /** + * Get the customRegistries property: The list of custom registries that were logged in during this run. + * + * @return the customRegistries value. + */ + public List customRegistries() { + return this.customRegistries; + } + + /** + * Get the runErrorMessage property: The error message received from backend systems after the run is scheduled. + * + * @return the runErrorMessage value. + */ + public String runErrorMessage() { + return this.runErrorMessage; + } + + /** + * Get the updateTriggerToken property: The update trigger token passed for the Run. + * + * @return the updateTriggerToken value. + */ + public String updateTriggerToken() { + return this.updateTriggerToken; + } + + /** + * Get the logArtifact property: The image description for the log artifact. + * + * @return the logArtifact value. + */ + public ImageDescriptor logArtifact() { + return this.logArtifact; + } + + /** + * Get the provisioningState property: The provisioning state of a run. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the isArchiveEnabled property: The value that indicates whether archiving is enabled or not. + * + * @return the isArchiveEnabled value. + */ + public Boolean isArchiveEnabled() { + return this.isArchiveEnabled; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("runId", this.runId); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("lastUpdatedTime", + this.lastUpdatedTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastUpdatedTime)); + jsonWriter.writeStringField("runType", this.runType == null ? null : this.runType.toString()); + jsonWriter.writeStringField("agentPoolName", this.agentPoolName); + jsonWriter.writeStringField("createTime", + this.createTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createTime)); + jsonWriter.writeStringField("startTime", + this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime)); + jsonWriter.writeStringField("finishTime", + this.finishTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.finishTime)); + jsonWriter.writeArrayField("outputImages", this.outputImages, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("task", this.task); + jsonWriter.writeJsonField("imageUpdateTrigger", this.imageUpdateTrigger); + jsonWriter.writeJsonField("sourceTrigger", this.sourceTrigger); + jsonWriter.writeJsonField("timerTrigger", this.timerTrigger); + jsonWriter.writeJsonField("platform", this.platform); + jsonWriter.writeJsonField("agentConfiguration", this.agentConfiguration); + jsonWriter.writeStringField("sourceRegistryAuth", this.sourceRegistryAuth); + jsonWriter.writeArrayField("customRegistries", this.customRegistries, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("updateTriggerToken", this.updateTriggerToken); + jsonWriter.writeStringField("provisioningState", + this.provisioningState == null ? null : this.provisioningState.toString()); + jsonWriter.writeBooleanField("isArchiveEnabled", this.isArchiveEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RunProperties. + */ + public static RunProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunProperties deserializedRunProperties = new RunProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("runId".equals(fieldName)) { + deserializedRunProperties.runId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedRunProperties.status = RunStatus.fromString(reader.getString()); + } else if ("lastUpdatedTime".equals(fieldName)) { + deserializedRunProperties.lastUpdatedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("runType".equals(fieldName)) { + deserializedRunProperties.runType = RunType.fromString(reader.getString()); + } else if ("agentPoolName".equals(fieldName)) { + deserializedRunProperties.agentPoolName = reader.getString(); + } else if ("createTime".equals(fieldName)) { + deserializedRunProperties.createTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("startTime".equals(fieldName)) { + deserializedRunProperties.startTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("finishTime".equals(fieldName)) { + deserializedRunProperties.finishTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("outputImages".equals(fieldName)) { + List outputImages = reader.readArray(reader1 -> ImageDescriptor.fromJson(reader1)); + deserializedRunProperties.outputImages = outputImages; + } else if ("task".equals(fieldName)) { + deserializedRunProperties.task = reader.getString(); + } else if ("imageUpdateTrigger".equals(fieldName)) { + deserializedRunProperties.imageUpdateTrigger = ImageUpdateTrigger.fromJson(reader); + } else if ("sourceTrigger".equals(fieldName)) { + deserializedRunProperties.sourceTrigger = SourceTriggerDescriptor.fromJson(reader); + } else if ("timerTrigger".equals(fieldName)) { + deserializedRunProperties.timerTrigger = TimerTriggerDescriptor.fromJson(reader); + } else if ("platform".equals(fieldName)) { + deserializedRunProperties.platform = PlatformProperties.fromJson(reader); + } else if ("agentConfiguration".equals(fieldName)) { + deserializedRunProperties.agentConfiguration = AgentProperties.fromJson(reader); + } else if ("sourceRegistryAuth".equals(fieldName)) { + deserializedRunProperties.sourceRegistryAuth = reader.getString(); + } else if ("customRegistries".equals(fieldName)) { + List customRegistries = reader.readArray(reader1 -> reader1.getString()); + deserializedRunProperties.customRegistries = customRegistries; + } else if ("runErrorMessage".equals(fieldName)) { + deserializedRunProperties.runErrorMessage = reader.getString(); + } else if ("updateTriggerToken".equals(fieldName)) { + deserializedRunProperties.updateTriggerToken = reader.getString(); + } else if ("logArtifact".equals(fieldName)) { + deserializedRunProperties.logArtifact = ImageDescriptor.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedRunProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedRunProperties.isArchiveEnabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedRunProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunRequest.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunRequest.java new file mode 100644 index 000000000000..3a01a409e3df --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunRequest.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The request parameters for scheduling a run. + */ +@Fluent +public class RunRequest implements JsonSerializable { + /* + * The type of the run request. + */ + private String type = "RunRequest"; + + /* + * The value that indicates whether archiving is enabled for the run or not. + */ + private Boolean isArchiveEnabled; + + /* + * The dedicated agent pool for the run. + */ + private String agentPoolName; + + /* + * The template that describes the repository and tag information for run log artifact. + */ + private String logTemplate; + + /** + * Creates an instance of RunRequest class. + */ + public RunRequest() { + } + + /** + * Get the type property: The type of the run request. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the isArchiveEnabled property: The value that indicates whether archiving is enabled for the run or not. + * + * @return the isArchiveEnabled value. + */ + public Boolean isArchiveEnabled() { + return this.isArchiveEnabled; + } + + /** + * Set the isArchiveEnabled property: The value that indicates whether archiving is enabled for the run or not. + * + * @param isArchiveEnabled the isArchiveEnabled value to set. + * @return the RunRequest object itself. + */ + public RunRequest withIsArchiveEnabled(Boolean isArchiveEnabled) { + this.isArchiveEnabled = isArchiveEnabled; + return this; + } + + /** + * Get the agentPoolName property: The dedicated agent pool for the run. + * + * @return the agentPoolName value. + */ + public String agentPoolName() { + return this.agentPoolName; + } + + /** + * Set the agentPoolName property: The dedicated agent pool for the run. + * + * @param agentPoolName the agentPoolName value to set. + * @return the RunRequest object itself. + */ + public RunRequest withAgentPoolName(String agentPoolName) { + this.agentPoolName = agentPoolName; + return this; + } + + /** + * Get the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @return the logTemplate value. + */ + public String logTemplate() { + return this.logTemplate; + } + + /** + * Set the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @param logTemplate the logTemplate value to set. + * @return the RunRequest object itself. + */ + public RunRequest withLogTemplate(String logTemplate) { + this.logTemplate = logTemplate; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeBooleanField("isArchiveEnabled", this.isArchiveEnabled); + jsonWriter.writeStringField("agentPoolName", this.agentPoolName); + jsonWriter.writeStringField("logTemplate", this.logTemplate); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunRequest if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the RunRequest. + */ + public static RunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("DockerBuildRequest".equals(discriminatorValue)) { + return DockerBuildRequest.fromJson(readerToUse.reset()); + } else if ("FileTaskRunRequest".equals(discriminatorValue)) { + return FileTaskRunRequest.fromJson(readerToUse.reset()); + } else if ("TaskRunRequest".equals(discriminatorValue)) { + return TaskRunRequest.fromJson(readerToUse.reset()); + } else if ("EncodedTaskRunRequest".equals(discriminatorValue)) { + return EncodedTaskRunRequest.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static RunRequest fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunRequest deserializedRunRequest = new RunRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedRunRequest.type = reader.getString(); + } else if ("isArchiveEnabled".equals(fieldName)) { + deserializedRunRequest.isArchiveEnabled = reader.getNullable(JsonReader::getBoolean); + } else if ("agentPoolName".equals(fieldName)) { + deserializedRunRequest.agentPoolName = reader.getString(); + } else if ("logTemplate".equals(fieldName)) { + deserializedRunRequest.logTemplate = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRunRequest; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunStatus.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunStatus.java new file mode 100644 index 000000000000..35a6c18c4662 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunStatus.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current status of the run. + */ +public final class RunStatus extends ExpandableStringEnum { + /** + * Static value Queued for RunStatus. + */ + public static final RunStatus QUEUED = fromString("Queued"); + + /** + * Static value Started for RunStatus. + */ + public static final RunStatus STARTED = fromString("Started"); + + /** + * Static value Running for RunStatus. + */ + public static final RunStatus RUNNING = fromString("Running"); + + /** + * Static value Succeeded for RunStatus. + */ + public static final RunStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for RunStatus. + */ + public static final RunStatus FAILED = fromString("Failed"); + + /** + * Static value Canceled for RunStatus. + */ + public static final RunStatus CANCELED = fromString("Canceled"); + + /** + * Static value Error for RunStatus. + */ + public static final RunStatus ERROR = fromString("Error"); + + /** + * Static value Timeout for RunStatus. + */ + public static final RunStatus TIMEOUT = fromString("Timeout"); + + /** + * Creates a new instance of RunStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RunStatus() { + } + + /** + * Creates or finds a RunStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunStatus. + */ + public static RunStatus fromString(String name) { + return fromString(name, RunStatus.class); + } + + /** + * Gets known RunStatus values. + * + * @return known RunStatus values. + */ + public static Collection values() { + return values(RunStatus.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunType.java new file mode 100644 index 000000000000..f2ea49f81a63 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunType.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of run. + */ +public final class RunType extends ExpandableStringEnum { + /** + * Static value QuickBuild for RunType. + */ + public static final RunType QUICK_BUILD = fromString("QuickBuild"); + + /** + * Static value QuickRun for RunType. + */ + public static final RunType QUICK_RUN = fromString("QuickRun"); + + /** + * Static value AutoBuild for RunType. + */ + public static final RunType AUTO_BUILD = fromString("AutoBuild"); + + /** + * Static value AutoRun for RunType. + */ + public static final RunType AUTO_RUN = fromString("AutoRun"); + + /** + * Creates a new instance of RunType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public RunType() { + } + + /** + * Creates or finds a RunType from its string representation. + * + * @param name a name to look for. + * @return the corresponding RunType. + */ + public static RunType fromString(String name) { + return fromString(name, RunType.class); + } + + /** + * Gets known RunType values. + * + * @return known RunType values. + */ + public static Collection values() { + return values(RunType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunUpdateParameters.java new file mode 100644 index 000000000000..d577fea4a1c1 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunUpdateParameters.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The set of run properties that can be updated. + */ +@Fluent +public final class RunUpdateParameters implements JsonSerializable { + /* + * The value that indicates whether archiving is enabled or not. + */ + private Boolean isArchiveEnabled; + + /** + * Creates an instance of RunUpdateParameters class. + */ + public RunUpdateParameters() { + } + + /** + * Get the isArchiveEnabled property: The value that indicates whether archiving is enabled or not. + * + * @return the isArchiveEnabled value. + */ + public Boolean isArchiveEnabled() { + return this.isArchiveEnabled; + } + + /** + * Set the isArchiveEnabled property: The value that indicates whether archiving is enabled or not. + * + * @param isArchiveEnabled the isArchiveEnabled value to set. + * @return the RunUpdateParameters object itself. + */ + public RunUpdateParameters withIsArchiveEnabled(Boolean isArchiveEnabled) { + this.isArchiveEnabled = isArchiveEnabled; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isArchiveEnabled", this.isArchiveEnabled); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RunUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RunUpdateParameters if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the RunUpdateParameters. + */ + public static RunUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RunUpdateParameters deserializedRunUpdateParameters = new RunUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isArchiveEnabled".equals(fieldName)) { + deserializedRunUpdateParameters.isArchiveEnabled = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedRunUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Runs.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Runs.java new file mode 100644 index 000000000000..b9e9f74bd330 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Runs.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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 Runs. + */ +public interface Runs { + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 detailed information for a given run along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String registryName, String runId, Context context); + + /** + * Gets the detailed information for a given run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 the detailed information for a given run. + */ + Run get(String resourceGroupName, String registryName, String runId); + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties along with {@link Response}. + */ + Response updateWithResponse(String resourceGroupName, String registryName, String runId, + RunUpdateParameters runUpdateParameters, Context context); + + /** + * Patch the run properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run ID. + * @param runUpdateParameters The run update properties. + * @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 run resource properties. + */ + Run update(String resourceGroupName, String registryName, String runId, RunUpdateParameters runUpdateParameters); + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 all the runs for a registry as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Gets all the runs for a registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param filter The runs filter to apply on the operation. Arithmetic operators are not supported. The allowed + * string function is 'contains'. All logical operators except 'Not', 'Has', 'All' are allowed. + * @param top $top is supported for get list of runs, which limits the maximum number of runs to return. + * @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 all the runs for a registry as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName, String filter, Integer top, Context context); + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 a link to download the run logs along with {@link Response}. + */ + Response getLogSasUrlWithResponse(String resourceGroupName, String registryName, String runId, + Context context); + + /** + * Gets a link to download the run logs. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 a link to download the run logs. + */ + RunGetLogResult getLogSasUrl(String resourceGroupName, String registryName, String runId); + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 {@link Response}. + */ + Response cancelWithResponse(String resourceGroupName, String registryName, String runId, Context context); + + /** + * Cancel an existing run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param runId The run 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 cancel(String resourceGroupName, String registryName, String runId); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObject.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObject.java new file mode 100644 index 000000000000..49fb1030d808 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObject.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the properties of a secret object value. + */ +@Fluent +public final class SecretObject implements JsonSerializable { + /* + * The value of the secret. The format of this value will be determined + * based on the type of the secret object. If the type is Opaque, the value will be + * used as is without any modification. + */ + private String value; + + /* + * The type of the secret object which determines how the value of the secret object has to be + * interpreted. + */ + private SecretObjectType type; + + /** + * Creates an instance of SecretObject class. + */ + public SecretObject() { + } + + /** + * Get the value property: The value of the secret. The format of this value will be determined + * based on the type of the secret object. If the type is Opaque, the value will be + * used as is without any modification. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the secret. The format of this value will be determined + * based on the type of the secret object. If the type is Opaque, the value will be + * used as is without any modification. + * + * @param value the value value to set. + * @return the SecretObject object itself. + */ + public SecretObject withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the type property: The type of the secret object which determines how the value of the secret object has to + * be + * interpreted. + * + * @return the type value. + */ + public SecretObjectType type() { + return this.type; + } + + /** + * Set the type property: The type of the secret object which determines how the value of the secret object has to + * be + * interpreted. + * + * @param type the type value to set. + * @return the SecretObject object itself. + */ + public SecretObject withType(SecretObjectType type) { + this.type = type; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecretObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecretObject if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the SecretObject. + */ + public static SecretObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecretObject deserializedSecretObject = new SecretObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedSecretObject.value = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSecretObject.type = SecretObjectType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSecretObject; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObjectType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObjectType.java new file mode 100644 index 000000000000..16b4f262f83b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObjectType.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the secret object which determines how the value of the secret object has to be + * interpreted. + */ +public final class SecretObjectType extends ExpandableStringEnum { + /** + * Static value Opaque for SecretObjectType. + */ + public static final SecretObjectType OPAQUE = fromString("Opaque"); + + /** + * Static value Vaultsecret for SecretObjectType. + */ + public static final SecretObjectType VAULTSECRET = fromString("Vaultsecret"); + + /** + * Creates a new instance of SecretObjectType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecretObjectType() { + } + + /** + * Creates or finds a SecretObjectType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecretObjectType. + */ + public static SecretObjectType fromString(String name) { + return fromString(name, SecretObjectType.class); + } + + /** + * Gets known SecretObjectType values. + * + * @return known SecretObjectType values. + */ + public static Collection values() { + return values(SecretObjectType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SetValue.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SetValue.java new file mode 100644 index 000000000000..0b1e5ec00a8d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SetValue.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a overridable value that can be passed to a task template. + */ +@Fluent +public final class SetValue implements JsonSerializable { + /* + * The name of the overridable value. + */ + private String name; + + /* + * The overridable value. + */ + private String value; + + /* + * Flag to indicate whether the value represents a secret or not. + */ + private Boolean isSecret; + + /** + * Creates an instance of SetValue class. + */ + public SetValue() { + } + + /** + * Get the name property: The name of the overridable value. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the overridable value. + * + * @param name the name value to set. + * @return the SetValue object itself. + */ + public SetValue withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The overridable value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The overridable value. + * + * @param value the value value to set. + * @return the SetValue object itself. + */ + public SetValue withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the isSecret property: Flag to indicate whether the value represents a secret or not. + * + * @return the isSecret value. + */ + public Boolean isSecret() { + return this.isSecret; + } + + /** + * Set the isSecret property: Flag to indicate whether the value represents a secret or not. + * + * @param isSecret the isSecret value to set. + * @return the SetValue object itself. + */ + public SetValue withIsSecret(Boolean isSecret) { + this.isSecret = isSecret; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeBooleanField("isSecret", this.isSecret); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SetValue from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SetValue if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SetValue. + */ + public static SetValue fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SetValue deserializedSetValue = new SetValue(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSetValue.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedSetValue.value = reader.getString(); + } else if ("isSecret".equals(fieldName)) { + deserializedSetValue.isSecret = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedSetValue; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceControlType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceControlType.java new file mode 100644 index 000000000000..c74690129ab4 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceControlType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of source control service. + */ +public final class SourceControlType extends ExpandableStringEnum { + /** + * Static value Github for SourceControlType. + */ + public static final SourceControlType GITHUB = fromString("Github"); + + /** + * Static value VisualStudioTeamService for SourceControlType. + */ + public static final SourceControlType VISUAL_STUDIO_TEAM_SERVICE = fromString("VisualStudioTeamService"); + + /** + * Creates a new instance of SourceControlType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SourceControlType() { + } + + /** + * Creates or finds a SourceControlType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceControlType. + */ + public static SourceControlType fromString(String name) { + return fromString(name, SourceControlType.class); + } + + /** + * Gets known SourceControlType values. + * + * @return known SourceControlType values. + */ + public static Collection values() { + return values(SourceControlType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceProperties.java new file mode 100644 index 000000000000..d678867accab --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceProperties.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of the source code repository. + */ +@Fluent +public final class SourceProperties implements JsonSerializable { + /* + * The type of source control service. + */ + private SourceControlType sourceControlType; + + /* + * The full URL to the source code repository + */ + private String repositoryUrl; + + /* + * The branch name of the source code. + */ + private String branch; + + /* + * The authorization properties for accessing the source code repository and to set up + * webhooks for notifications. + */ + private AuthInfo sourceControlAuthProperties; + + /** + * Creates an instance of SourceProperties class. + */ + public SourceProperties() { + } + + /** + * Get the sourceControlType property: The type of source control service. + * + * @return the sourceControlType value. + */ + public SourceControlType sourceControlType() { + return this.sourceControlType; + } + + /** + * Set the sourceControlType property: The type of source control service. + * + * @param sourceControlType the sourceControlType value to set. + * @return the SourceProperties object itself. + */ + public SourceProperties withSourceControlType(SourceControlType sourceControlType) { + this.sourceControlType = sourceControlType; + return this; + } + + /** + * Get the repositoryUrl property: The full URL to the source code repository. + * + * @return the repositoryUrl value. + */ + public String repositoryUrl() { + return this.repositoryUrl; + } + + /** + * Set the repositoryUrl property: The full URL to the source code repository. + * + * @param repositoryUrl the repositoryUrl value to set. + * @return the SourceProperties object itself. + */ + public SourceProperties withRepositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + return this; + } + + /** + * Get the branch property: The branch name of the source code. + * + * @return the branch value. + */ + public String branch() { + return this.branch; + } + + /** + * Set the branch property: The branch name of the source code. + * + * @param branch the branch value to set. + * @return the SourceProperties object itself. + */ + public SourceProperties withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the sourceControlAuthProperties property: The authorization properties for accessing the source code + * repository and to set up + * webhooks for notifications. + * + * @return the sourceControlAuthProperties value. + */ + public AuthInfo sourceControlAuthProperties() { + return this.sourceControlAuthProperties; + } + + /** + * Set the sourceControlAuthProperties property: The authorization properties for accessing the source code + * repository and to set up + * webhooks for notifications. + * + * @param sourceControlAuthProperties the sourceControlAuthProperties value to set. + * @return the SourceProperties object itself. + */ + public SourceProperties withSourceControlAuthProperties(AuthInfo sourceControlAuthProperties) { + this.sourceControlAuthProperties = sourceControlAuthProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceControlType", + this.sourceControlType == null ? null : this.sourceControlType.toString()); + jsonWriter.writeStringField("repositoryUrl", this.repositoryUrl); + jsonWriter.writeStringField("branch", this.branch); + jsonWriter.writeJsonField("sourceControlAuthProperties", this.sourceControlAuthProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SourceProperties. + */ + public static SourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceProperties deserializedSourceProperties = new SourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceControlType".equals(fieldName)) { + deserializedSourceProperties.sourceControlType = SourceControlType.fromString(reader.getString()); + } else if ("repositoryUrl".equals(fieldName)) { + deserializedSourceProperties.repositoryUrl = reader.getString(); + } else if ("branch".equals(fieldName)) { + deserializedSourceProperties.branch = reader.getString(); + } else if ("sourceControlAuthProperties".equals(fieldName)) { + deserializedSourceProperties.sourceControlAuthProperties = AuthInfo.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryCredentials.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryCredentials.java new file mode 100644 index 000000000000..5f9cce4e1463 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryCredentials.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Describes the credential parameters for accessing the source registry. + */ +@Fluent +public final class SourceRegistryCredentials implements JsonSerializable { + /* + * The Entra identity used for source registry login. + * The value is `[system]` for system-assigned managed identity, `[caller]` for caller identity, + * and client ID for user-assigned managed identity. + */ + private String identity; + + /* + * The authentication mode which determines the source registry login scope. The credentials for the source registry + * will be generated using the given scope. These credentials will be used to login to + * the source registry during the run. + */ + private SourceRegistryLoginMode loginMode; + + /** + * Creates an instance of SourceRegistryCredentials class. + */ + public SourceRegistryCredentials() { + } + + /** + * Get the identity property: The Entra identity used for source registry login. + * The value is `[system]` for system-assigned managed identity, `[caller]` for caller identity, + * and client ID for user-assigned managed identity. + * + * @return the identity value. + */ + public String identity() { + return this.identity; + } + + /** + * Set the identity property: The Entra identity used for source registry login. + * The value is `[system]` for system-assigned managed identity, `[caller]` for caller identity, + * and client ID for user-assigned managed identity. + * + * @param identity the identity value to set. + * @return the SourceRegistryCredentials object itself. + */ + public SourceRegistryCredentials withIdentity(String identity) { + this.identity = identity; + return this; + } + + /** + * Get the loginMode property: The authentication mode which determines the source registry login scope. The + * credentials for the source registry + * will be generated using the given scope. These credentials will be used to login to + * the source registry during the run. + * + * @return the loginMode value. + */ + public SourceRegistryLoginMode loginMode() { + return this.loginMode; + } + + /** + * Set the loginMode property: The authentication mode which determines the source registry login scope. The + * credentials for the source registry + * will be generated using the given scope. These credentials will be used to login to + * the source registry during the run. + * + * @param loginMode the loginMode value to set. + * @return the SourceRegistryCredentials object itself. + */ + public SourceRegistryCredentials withLoginMode(SourceRegistryLoginMode loginMode) { + this.loginMode = loginMode; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("identity", this.identity); + jsonWriter.writeStringField("loginMode", this.loginMode == null ? null : this.loginMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceRegistryCredentials from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceRegistryCredentials if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the SourceRegistryCredentials. + */ + public static SourceRegistryCredentials fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceRegistryCredentials deserializedSourceRegistryCredentials = new SourceRegistryCredentials(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedSourceRegistryCredentials.identity = reader.getString(); + } else if ("loginMode".equals(fieldName)) { + deserializedSourceRegistryCredentials.loginMode + = SourceRegistryLoginMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceRegistryCredentials; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryLoginMode.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryLoginMode.java new file mode 100644 index 000000000000..75a867788d37 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryLoginMode.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The authentication mode which determines the source registry login scope. The credentials for the source registry + * will be generated using the given scope. These credentials will be used to login to + * the source registry during the run. + */ +public final class SourceRegistryLoginMode extends ExpandableStringEnum { + /** + * Static value None for SourceRegistryLoginMode. + */ + public static final SourceRegistryLoginMode NONE = fromString("None"); + + /** + * Static value Default for SourceRegistryLoginMode. + */ + public static final SourceRegistryLoginMode DEFAULT = fromString("Default"); + + /** + * Creates a new instance of SourceRegistryLoginMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SourceRegistryLoginMode() { + } + + /** + * Creates or finds a SourceRegistryLoginMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceRegistryLoginMode. + */ + public static SourceRegistryLoginMode fromString(String name) { + return fromString(name, SourceRegistryLoginMode.class); + } + + /** + * Gets known SourceRegistryLoginMode values. + * + * @return known SourceRegistryLoginMode values. + */ + public static Collection values() { + return values(SourceRegistryLoginMode.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTrigger.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTrigger.java new file mode 100644 index 000000000000..cdc1298b6e03 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTrigger.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a source based trigger. + */ +@Fluent +public final class SourceTrigger implements JsonSerializable { + /* + * The properties that describes the source(code) for the task. + */ + private SourceProperties sourceRepository; + + /* + * The source event corresponding to the trigger. + */ + private List sourceTriggerEvents; + + /* + * The current status of trigger. + */ + private TriggerStatus status; + + /* + * The name of the trigger. + */ + private String name; + + /** + * Creates an instance of SourceTrigger class. + */ + public SourceTrigger() { + } + + /** + * Get the sourceRepository property: The properties that describes the source(code) for the task. + * + * @return the sourceRepository value. + */ + public SourceProperties sourceRepository() { + return this.sourceRepository; + } + + /** + * Set the sourceRepository property: The properties that describes the source(code) for the task. + * + * @param sourceRepository the sourceRepository value to set. + * @return the SourceTrigger object itself. + */ + public SourceTrigger withSourceRepository(SourceProperties sourceRepository) { + this.sourceRepository = sourceRepository; + return this; + } + + /** + * Get the sourceTriggerEvents property: The source event corresponding to the trigger. + * + * @return the sourceTriggerEvents value. + */ + public List sourceTriggerEvents() { + return this.sourceTriggerEvents; + } + + /** + * Set the sourceTriggerEvents property: The source event corresponding to the trigger. + * + * @param sourceTriggerEvents the sourceTriggerEvents value to set. + * @return the SourceTrigger object itself. + */ + public SourceTrigger withSourceTriggerEvents(List sourceTriggerEvents) { + this.sourceTriggerEvents = sourceTriggerEvents; + return this; + } + + /** + * Get the status property: The current status of trigger. + * + * @return the status value. + */ + public TriggerStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of trigger. + * + * @param status the status value to set. + * @return the SourceTrigger object itself. + */ + public SourceTrigger withStatus(TriggerStatus status) { + this.status = status; + return this; + } + + /** + * Get the name property: The name of the trigger. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the trigger. + * + * @param name the name value to set. + * @return the SourceTrigger object itself. + */ + public SourceTrigger withName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("sourceRepository", this.sourceRepository); + jsonWriter.writeArrayField("sourceTriggerEvents", this.sourceTriggerEvents, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SourceTrigger. + */ + public static SourceTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceTrigger deserializedSourceTrigger = new SourceTrigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceRepository".equals(fieldName)) { + deserializedSourceTrigger.sourceRepository = SourceProperties.fromJson(reader); + } else if ("sourceTriggerEvents".equals(fieldName)) { + List sourceTriggerEvents + = reader.readArray(reader1 -> SourceTriggerEvent.fromString(reader1.getString())); + deserializedSourceTrigger.sourceTriggerEvents = sourceTriggerEvents; + } else if ("name".equals(fieldName)) { + deserializedSourceTrigger.name = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedSourceTrigger.status = TriggerStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceTrigger; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerDescriptor.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerDescriptor.java new file mode 100644 index 000000000000..83df1beb2dcb --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerDescriptor.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The source trigger that caused a run. + */ +@Immutable +public final class SourceTriggerDescriptor implements JsonSerializable { + /* + * The unique ID of the trigger. + */ + private String id; + + /* + * The event type of the trigger. + */ + private String eventType; + + /* + * The unique ID that identifies a commit. + */ + private String commitId; + + /* + * The unique ID that identifies pull request. + */ + private String pullRequestId; + + /* + * The repository URL. + */ + private String repositoryUrl; + + /* + * The branch name in the repository. + */ + private String branchName; + + /* + * The source control provider type. + */ + private String providerType; + + /** + * Creates an instance of SourceTriggerDescriptor class. + */ + private SourceTriggerDescriptor() { + } + + /** + * Get the id property: The unique ID of the trigger. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the eventType property: The event type of the trigger. + * + * @return the eventType value. + */ + public String eventType() { + return this.eventType; + } + + /** + * Get the commitId property: The unique ID that identifies a commit. + * + * @return the commitId value. + */ + public String commitId() { + return this.commitId; + } + + /** + * Get the pullRequestId property: The unique ID that identifies pull request. + * + * @return the pullRequestId value. + */ + public String pullRequestId() { + return this.pullRequestId; + } + + /** + * Get the repositoryUrl property: The repository URL. + * + * @return the repositoryUrl value. + */ + public String repositoryUrl() { + return this.repositoryUrl; + } + + /** + * Get the branchName property: The branch name in the repository. + * + * @return the branchName value. + */ + public String branchName() { + return this.branchName; + } + + /** + * Get the providerType property: The source control provider type. + * + * @return the providerType value. + */ + public String providerType() { + return this.providerType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("eventType", this.eventType); + jsonWriter.writeStringField("commitId", this.commitId); + jsonWriter.writeStringField("pullRequestId", this.pullRequestId); + jsonWriter.writeStringField("repositoryUrl", this.repositoryUrl); + jsonWriter.writeStringField("branchName", this.branchName); + jsonWriter.writeStringField("providerType", this.providerType); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceTriggerDescriptor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceTriggerDescriptor if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SourceTriggerDescriptor. + */ + public static SourceTriggerDescriptor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceTriggerDescriptor deserializedSourceTriggerDescriptor = new SourceTriggerDescriptor(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSourceTriggerDescriptor.id = reader.getString(); + } else if ("eventType".equals(fieldName)) { + deserializedSourceTriggerDescriptor.eventType = reader.getString(); + } else if ("commitId".equals(fieldName)) { + deserializedSourceTriggerDescriptor.commitId = reader.getString(); + } else if ("pullRequestId".equals(fieldName)) { + deserializedSourceTriggerDescriptor.pullRequestId = reader.getString(); + } else if ("repositoryUrl".equals(fieldName)) { + deserializedSourceTriggerDescriptor.repositoryUrl = reader.getString(); + } else if ("branchName".equals(fieldName)) { + deserializedSourceTriggerDescriptor.branchName = reader.getString(); + } else if ("providerType".equals(fieldName)) { + deserializedSourceTriggerDescriptor.providerType = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceTriggerDescriptor; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerEvent.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerEvent.java new file mode 100644 index 000000000000..73f0371b5caf --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerEvent.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines values for SourceTriggerEvent. + */ +public final class SourceTriggerEvent extends ExpandableStringEnum { + /** + * Static value commit for SourceTriggerEvent. + */ + public static final SourceTriggerEvent COMMIT = fromString("commit"); + + /** + * Static value pullrequest for SourceTriggerEvent. + */ + public static final SourceTriggerEvent PULLREQUEST = fromString("pullrequest"); + + /** + * Creates a new instance of SourceTriggerEvent value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SourceTriggerEvent() { + } + + /** + * Creates or finds a SourceTriggerEvent from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceTriggerEvent. + */ + public static SourceTriggerEvent fromString(String name) { + return fromString(name, SourceTriggerEvent.class); + } + + /** + * Gets known SourceTriggerEvent values. + * + * @return known SourceTriggerEvent values. + */ + public static Collection values() { + return values(SourceTriggerEvent.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerUpdateParameters.java new file mode 100644 index 000000000000..eed333ab7513 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerUpdateParameters.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties for updating a source based trigger. + */ +@Fluent +public final class SourceTriggerUpdateParameters implements JsonSerializable { + /* + * The properties that describes the source(code) for the task. + */ + private SourceUpdateParameters sourceRepository; + + /* + * The source event corresponding to the trigger. + */ + private List sourceTriggerEvents; + + /* + * The current status of trigger. + */ + private TriggerStatus status; + + /* + * The name of the trigger. + */ + private String name; + + /** + * Creates an instance of SourceTriggerUpdateParameters class. + */ + public SourceTriggerUpdateParameters() { + } + + /** + * Get the sourceRepository property: The properties that describes the source(code) for the task. + * + * @return the sourceRepository value. + */ + public SourceUpdateParameters sourceRepository() { + return this.sourceRepository; + } + + /** + * Set the sourceRepository property: The properties that describes the source(code) for the task. + * + * @param sourceRepository the sourceRepository value to set. + * @return the SourceTriggerUpdateParameters object itself. + */ + public SourceTriggerUpdateParameters withSourceRepository(SourceUpdateParameters sourceRepository) { + this.sourceRepository = sourceRepository; + return this; + } + + /** + * Get the sourceTriggerEvents property: The source event corresponding to the trigger. + * + * @return the sourceTriggerEvents value. + */ + public List sourceTriggerEvents() { + return this.sourceTriggerEvents; + } + + /** + * Set the sourceTriggerEvents property: The source event corresponding to the trigger. + * + * @param sourceTriggerEvents the sourceTriggerEvents value to set. + * @return the SourceTriggerUpdateParameters object itself. + */ + public SourceTriggerUpdateParameters withSourceTriggerEvents(List sourceTriggerEvents) { + this.sourceTriggerEvents = sourceTriggerEvents; + return this; + } + + /** + * Get the status property: The current status of trigger. + * + * @return the status value. + */ + public TriggerStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of trigger. + * + * @param status the status value to set. + * @return the SourceTriggerUpdateParameters object itself. + */ + public SourceTriggerUpdateParameters withStatus(TriggerStatus status) { + this.status = status; + return this; + } + + /** + * Get the name property: The name of the trigger. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the trigger. + * + * @param name the name value to set. + * @return the SourceTriggerUpdateParameters object itself. + */ + public SourceTriggerUpdateParameters withName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeJsonField("sourceRepository", this.sourceRepository); + jsonWriter.writeArrayField("sourceTriggerEvents", this.sourceTriggerEvents, + (writer, element) -> writer.writeString(element == null ? null : element.toString())); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceTriggerUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceTriggerUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SourceTriggerUpdateParameters. + */ + public static SourceTriggerUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceTriggerUpdateParameters deserializedSourceTriggerUpdateParameters + = new SourceTriggerUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSourceTriggerUpdateParameters.name = reader.getString(); + } else if ("sourceRepository".equals(fieldName)) { + deserializedSourceTriggerUpdateParameters.sourceRepository + = SourceUpdateParameters.fromJson(reader); + } else if ("sourceTriggerEvents".equals(fieldName)) { + List sourceTriggerEvents + = reader.readArray(reader1 -> SourceTriggerEvent.fromString(reader1.getString())); + deserializedSourceTriggerUpdateParameters.sourceTriggerEvents = sourceTriggerEvents; + } else if ("status".equals(fieldName)) { + deserializedSourceTriggerUpdateParameters.status = TriggerStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceTriggerUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUpdateParameters.java new file mode 100644 index 000000000000..1399c243a051 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUpdateParameters.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties for updating the source code repository. + */ +@Fluent +public final class SourceUpdateParameters implements JsonSerializable { + /* + * The type of source control service. + */ + private SourceControlType sourceControlType; + + /* + * The full URL to the source code repository + */ + private String repositoryUrl; + + /* + * The branch name of the source code. + */ + private String branch; + + /* + * The authorization properties for accessing the source code repository and to set up + * webhooks for notifications. + */ + private AuthInfoUpdateParameters sourceControlAuthProperties; + + /** + * Creates an instance of SourceUpdateParameters class. + */ + public SourceUpdateParameters() { + } + + /** + * Get the sourceControlType property: The type of source control service. + * + * @return the sourceControlType value. + */ + public SourceControlType sourceControlType() { + return this.sourceControlType; + } + + /** + * Set the sourceControlType property: The type of source control service. + * + * @param sourceControlType the sourceControlType value to set. + * @return the SourceUpdateParameters object itself. + */ + public SourceUpdateParameters withSourceControlType(SourceControlType sourceControlType) { + this.sourceControlType = sourceControlType; + return this; + } + + /** + * Get the repositoryUrl property: The full URL to the source code repository. + * + * @return the repositoryUrl value. + */ + public String repositoryUrl() { + return this.repositoryUrl; + } + + /** + * Set the repositoryUrl property: The full URL to the source code repository. + * + * @param repositoryUrl the repositoryUrl value to set. + * @return the SourceUpdateParameters object itself. + */ + public SourceUpdateParameters withRepositoryUrl(String repositoryUrl) { + this.repositoryUrl = repositoryUrl; + return this; + } + + /** + * Get the branch property: The branch name of the source code. + * + * @return the branch value. + */ + public String branch() { + return this.branch; + } + + /** + * Set the branch property: The branch name of the source code. + * + * @param branch the branch value to set. + * @return the SourceUpdateParameters object itself. + */ + public SourceUpdateParameters withBranch(String branch) { + this.branch = branch; + return this; + } + + /** + * Get the sourceControlAuthProperties property: The authorization properties for accessing the source code + * repository and to set up + * webhooks for notifications. + * + * @return the sourceControlAuthProperties value. + */ + public AuthInfoUpdateParameters sourceControlAuthProperties() { + return this.sourceControlAuthProperties; + } + + /** + * Set the sourceControlAuthProperties property: The authorization properties for accessing the source code + * repository and to set up + * webhooks for notifications. + * + * @param sourceControlAuthProperties the sourceControlAuthProperties value to set. + * @return the SourceUpdateParameters object itself. + */ + public SourceUpdateParameters + withSourceControlAuthProperties(AuthInfoUpdateParameters sourceControlAuthProperties) { + this.sourceControlAuthProperties = sourceControlAuthProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceControlType", + this.sourceControlType == null ? null : this.sourceControlType.toString()); + jsonWriter.writeStringField("repositoryUrl", this.repositoryUrl); + jsonWriter.writeStringField("branch", this.branch); + jsonWriter.writeJsonField("sourceControlAuthProperties", this.sourceControlAuthProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SourceUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SourceUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the SourceUpdateParameters. + */ + public static SourceUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SourceUpdateParameters deserializedSourceUpdateParameters = new SourceUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceControlType".equals(fieldName)) { + deserializedSourceUpdateParameters.sourceControlType + = SourceControlType.fromString(reader.getString()); + } else if ("repositoryUrl".equals(fieldName)) { + deserializedSourceUpdateParameters.repositoryUrl = reader.getString(); + } else if ("branch".equals(fieldName)) { + deserializedSourceUpdateParameters.branch = reader.getString(); + } else if ("sourceControlAuthProperties".equals(fieldName)) { + deserializedSourceUpdateParameters.sourceControlAuthProperties + = AuthInfoUpdateParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSourceUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUploadDefinition.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUploadDefinition.java new file mode 100644 index 000000000000..c2ea348c959b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUploadDefinition.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner; + +/** + * An immutable client-side representation of SourceUploadDefinition. + */ +public interface SourceUploadDefinition { + /** + * Gets the uploadUrl property: The URL where the client can upload the source. + * + * @return the uploadUrl value. + */ + String uploadUrl(); + + /** + * Gets the relativePath property: The relative path to the source. This is used to submit the subsequent queue + * build request. + * + * @return the relativePath value. + */ + String relativePath(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner + * object. + * + * @return the inner object. + */ + SourceUploadDefinitionInner innerModel(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/StepType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/StepType.java new file mode 100644 index 000000000000..7548d854f382 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/StepType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of the step. + */ +public final class StepType extends ExpandableStringEnum { + /** + * Static value Docker for StepType. + */ + public static final StepType DOCKER = fromString("Docker"); + + /** + * Static value FileTask for StepType. + */ + public static final StepType FILE_TASK = fromString("FileTask"); + + /** + * Static value EncodedTask for StepType. + */ + public static final StepType ENCODED_TASK = fromString("EncodedTask"); + + /** + * Creates a new instance of StepType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StepType() { + } + + /** + * Creates or finds a StepType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StepType. + */ + public static StepType fromString(String name) { + return fromString(name, StepType.class); + } + + /** + * Gets known StepType values. + * + * @return known StepType values. + */ + public static Collection values() { + return values(StepType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Task.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Task.java new file mode 100644 index 000000000000..27c1cef519cd --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Task.java @@ -0,0 +1,433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner; +import java.util.Map; + +/** + * An immutable client-side representation of Task. + */ +public interface Task { + /** + * 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 properties property: The properties of a task. + * + * @return the properties value. + */ + TaskProperties properties(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner object. + * + * @return the inner object. + */ + TaskInner innerModel(); + + /** + * The entirety of the Task definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Task definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Task definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Task 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. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the Task definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, registryName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @return the next definition stage. + */ + WithCreate withExistingRegistry(String resourceGroupName, String registryName); + } + + /** + * The stage of the Task 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, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + Task create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Task create(Context context); + } + + /** + * The stage of the Task 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); + } + + /** + * The stage of the Task definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The properties of a task.. + * + * @param properties The properties of a task. + * @return the next definition stage. + */ + WithCreate withProperties(TaskProperties properties); + } + + /** + * The stage of the Task definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(IdentityProperties identity); + } + } + + /** + * Begins update for the Task resource. + * + * @return the stage of resource update. + */ + Task.Update update(); + + /** + * The template for Task update. + */ + interface Update + extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithStatus, UpdateStages.WithPlatform, + UpdateStages.WithAgentConfiguration, UpdateStages.WithAgentPoolName, UpdateStages.WithTimeout, + UpdateStages.WithStep, UpdateStages.WithTrigger, UpdateStages.WithCredentials, UpdateStages.WithLogTemplate { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Task apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Task apply(Context context); + } + + /** + * The Task update stages. + */ + interface UpdateStages { + /** + * The stage of the Task update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The ARM resource tags.. + * + * @param tags The ARM resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Task update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(IdentityProperties identity); + } + + /** + * The stage of the Task update allowing to specify status. + */ + interface WithStatus { + /** + * Specifies the status property: The current status of task.. + * + * @param status The current status of task. + * @return the next definition stage. + */ + Update withStatus(TaskStatus status); + } + + /** + * The stage of the Task update allowing to specify platform. + */ + interface WithPlatform { + /** + * Specifies the platform property: The platform properties against which the run has to happen.. + * + * @param platform The platform properties against which the run has to happen. + * @return the next definition stage. + */ + Update withPlatform(PlatformUpdateParameters platform); + } + + /** + * The stage of the Task update allowing to specify agentConfiguration. + */ + interface WithAgentConfiguration { + /** + * Specifies the agentConfiguration property: The machine configuration of the run agent.. + * + * @param agentConfiguration The machine configuration of the run agent. + * @return the next definition stage. + */ + Update withAgentConfiguration(AgentProperties agentConfiguration); + } + + /** + * The stage of the Task update allowing to specify agentPoolName. + */ + interface WithAgentPoolName { + /** + * Specifies the agentPoolName property: The dedicated agent pool for the task.. + * + * @param agentPoolName The dedicated agent pool for the task. + * @return the next definition stage. + */ + Update withAgentPoolName(String agentPoolName); + } + + /** + * The stage of the Task update allowing to specify timeout. + */ + interface WithTimeout { + /** + * Specifies the timeout property: Run timeout in seconds.. + * + * @param timeout Run timeout in seconds. + * @return the next definition stage. + */ + Update withTimeout(Integer timeout); + } + + /** + * The stage of the Task update allowing to specify step. + */ + interface WithStep { + /** + * Specifies the step property: The properties for updating a task step.. + * + * @param step The properties for updating a task step. + * @return the next definition stage. + */ + Update withStep(TaskStepUpdateParameters step); + } + + /** + * The stage of the Task update allowing to specify trigger. + */ + interface WithTrigger { + /** + * Specifies the trigger property: The properties for updating trigger properties.. + * + * @param trigger The properties for updating trigger properties. + * @return the next definition stage. + */ + Update withTrigger(TriggerUpdateParameters trigger); + } + + /** + * The stage of the Task update allowing to specify credentials. + */ + interface WithCredentials { + /** + * Specifies the credentials property: The parameters that describes a set of credentials that will be used + * when this run is invoked.. + * + * @param credentials The parameters that describes a set of credentials that will be used when this run is + * invoked. + * @return the next definition stage. + */ + Update withCredentials(Credentials credentials); + } + + /** + * The stage of the Task update allowing to specify logTemplate. + */ + interface WithLogTemplate { + /** + * Specifies the logTemplate property: The template that describes the repository and tag information for + * run log artifact.. + * + * @param logTemplate The template that describes the repository and tag information for run log artifact. + * @return the next definition stage. + */ + Update withLogTemplate(String logTemplate); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Task refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Task refresh(Context context); + + /** + * Returns a task with extended information that includes all secrets. + * + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + Response getDetailsWithResponse(Context context); + + /** + * Returns a task with extended information that includes all secrets. + * + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + Task getDetails(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskProperties.java new file mode 100644 index 000000000000..ca4570a13146 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskProperties.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.time.OffsetDateTime; + +/** + * The properties of a task. + */ +@Fluent +public final class TaskProperties implements JsonSerializable { + /* + * The provisioning state of the task. + */ + private ProvisioningState provisioningState; + + /* + * The creation date of task. + */ + private OffsetDateTime creationDate; + + /* + * The current status of task. + */ + private TaskStatus status; + + /* + * The platform properties against which the run has to happen. + */ + private PlatformProperties platform; + + /* + * The machine configuration of the run agent. + */ + private AgentProperties agentConfiguration; + + /* + * The dedicated agent pool for the task. + */ + private String agentPoolName; + + /* + * Run timeout in seconds. + */ + private Integer timeout; + + /* + * The properties of a task step. + */ + private TaskStepProperties step; + + /* + * The properties that describe all triggers for the task. + */ + private TriggerProperties trigger; + + /* + * The properties that describes a set of credentials that will be used when this run is invoked. + */ + private Credentials credentials; + + /* + * The template that describes the repository and tag information for run log artifact. + */ + private String logTemplate; + + /* + * The value of this property indicates whether the task resource is system task or not. + */ + private Boolean isSystemTask; + + /** + * Creates an instance of TaskProperties class. + */ + public TaskProperties() { + } + + /** + * Get the provisioningState property: The provisioning state of the task. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the creationDate property: The creation date of task. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Get the status property: The current status of task. + * + * @return the status value. + */ + public TaskStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of task. + * + * @param status the status value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withStatus(TaskStatus status) { + this.status = status; + return this; + } + + /** + * Get the platform property: The platform properties against which the run has to happen. + * + * @return the platform value. + */ + public PlatformProperties platform() { + return this.platform; + } + + /** + * Set the platform property: The platform properties against which the run has to happen. + * + * @param platform the platform value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withPlatform(PlatformProperties platform) { + this.platform = platform; + return this; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.agentConfiguration; + } + + /** + * Set the agentConfiguration property: The machine configuration of the run agent. + * + * @param agentConfiguration the agentConfiguration value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withAgentConfiguration(AgentProperties agentConfiguration) { + this.agentConfiguration = agentConfiguration; + return this; + } + + /** + * Get the agentPoolName property: The dedicated agent pool for the task. + * + * @return the agentPoolName value. + */ + public String agentPoolName() { + return this.agentPoolName; + } + + /** + * Set the agentPoolName property: The dedicated agent pool for the task. + * + * @param agentPoolName the agentPoolName value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withAgentPoolName(String agentPoolName) { + this.agentPoolName = agentPoolName; + return this; + } + + /** + * Get the timeout property: Run timeout in seconds. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.timeout; + } + + /** + * Set the timeout property: Run timeout in seconds. + * + * @param timeout the timeout value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withTimeout(Integer timeout) { + this.timeout = timeout; + return this; + } + + /** + * Get the step property: The properties of a task step. + * + * @return the step value. + */ + public TaskStepProperties step() { + return this.step; + } + + /** + * Set the step property: The properties of a task step. + * + * @param step the step value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withStep(TaskStepProperties step) { + this.step = step; + return this; + } + + /** + * Get the trigger property: The properties that describe all triggers for the task. + * + * @return the trigger value. + */ + public TriggerProperties trigger() { + return this.trigger; + } + + /** + * Set the trigger property: The properties that describe all triggers for the task. + * + * @param trigger the trigger value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withTrigger(TriggerProperties trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @return the credentials value. + */ + public Credentials credentials() { + return this.credentials; + } + + /** + * Set the credentials property: The properties that describes a set of credentials that will be used when this run + * is invoked. + * + * @param credentials the credentials value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withCredentials(Credentials credentials) { + this.credentials = credentials; + return this; + } + + /** + * Get the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @return the logTemplate value. + */ + public String logTemplate() { + return this.logTemplate; + } + + /** + * Set the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @param logTemplate the logTemplate value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withLogTemplate(String logTemplate) { + this.logTemplate = logTemplate; + return this; + } + + /** + * Get the isSystemTask property: The value of this property indicates whether the task resource is system task or + * not. + * + * @return the isSystemTask value. + */ + public Boolean isSystemTask() { + return this.isSystemTask; + } + + /** + * Set the isSystemTask property: The value of this property indicates whether the task resource is system task or + * not. + * + * @param isSystemTask the isSystemTask value to set. + * @return the TaskProperties object itself. + */ + public TaskProperties withIsSystemTask(Boolean isSystemTask) { + this.isSystemTask = isSystemTask; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeJsonField("platform", this.platform); + jsonWriter.writeJsonField("agentConfiguration", this.agentConfiguration); + jsonWriter.writeStringField("agentPoolName", this.agentPoolName); + jsonWriter.writeNumberField("timeout", this.timeout); + jsonWriter.writeJsonField("step", this.step); + jsonWriter.writeJsonField("trigger", this.trigger); + jsonWriter.writeJsonField("credentials", this.credentials); + jsonWriter.writeStringField("logTemplate", this.logTemplate); + jsonWriter.writeBooleanField("isSystemTask", this.isSystemTask); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskProperties. + */ + public static TaskProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskProperties deserializedTaskProperties = new TaskProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedTaskProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("creationDate".equals(fieldName)) { + deserializedTaskProperties.creationDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("status".equals(fieldName)) { + deserializedTaskProperties.status = TaskStatus.fromString(reader.getString()); + } else if ("platform".equals(fieldName)) { + deserializedTaskProperties.platform = PlatformProperties.fromJson(reader); + } else if ("agentConfiguration".equals(fieldName)) { + deserializedTaskProperties.agentConfiguration = AgentProperties.fromJson(reader); + } else if ("agentPoolName".equals(fieldName)) { + deserializedTaskProperties.agentPoolName = reader.getString(); + } else if ("timeout".equals(fieldName)) { + deserializedTaskProperties.timeout = reader.getNullable(JsonReader::getInt); + } else if ("step".equals(fieldName)) { + deserializedTaskProperties.step = TaskStepProperties.fromJson(reader); + } else if ("trigger".equals(fieldName)) { + deserializedTaskProperties.trigger = TriggerProperties.fromJson(reader); + } else if ("credentials".equals(fieldName)) { + deserializedTaskProperties.credentials = Credentials.fromJson(reader); + } else if ("logTemplate".equals(fieldName)) { + deserializedTaskProperties.logTemplate = reader.getString(); + } else if ("isSystemTask".equals(fieldName)) { + deserializedTaskProperties.isSystemTask = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRun.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRun.java new file mode 100644 index 000000000000..e3f3b5c4b363 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRun.java @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner; +import java.util.Map; + +/** + * An immutable client-side representation of TaskRun. + */ +public interface TaskRun { + /** + * 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 properties property: The properties associated with the task run, i.e., request and result of the run. + * + * @return the properties value. + */ + TaskRunProperties properties(); + + /** + * Gets the identity property: Identity for the resource. + * + * @return the identity value. + */ + IdentityProperties identity(); + + /** + * Gets the location property: The location of the resource. + * + * @return the location value. + */ + String location(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner object. + * + * @return the inner object. + */ + TaskRunInner innerModel(); + + /** + * The entirety of the TaskRun definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The TaskRun definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the TaskRun definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the TaskRun definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, registryName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @return the next definition stage. + */ + WithCreate withExistingRegistry(String resourceGroupName, String registryName); + } + + /** + * The stage of the TaskRun 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.WithLocation, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + TaskRun create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TaskRun create(Context context); + } + + /** + * The stage of the TaskRun definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The location of the resource. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The location of the resource. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + + /** + * The stage of the TaskRun definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The properties associated with the task run, i.e., request and result + * of the run. + * + * @param properties The properties associated with the task run, i.e., request and result of the run. + * @return the next definition stage. + */ + WithCreate withProperties(TaskRunPropertiesInner properties); + } + + /** + * The stage of the TaskRun definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(IdentityProperties identity); + } + } + + /** + * Begins update for the TaskRun resource. + * + * @return the stage of resource update. + */ + TaskRun.Update update(); + + /** + * The template for TaskRun update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithRunRequest, + UpdateStages.WithForceUpdateTag { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TaskRun apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TaskRun apply(Context context); + } + + /** + * The TaskRun update stages. + */ + interface UpdateStages { + /** + * The stage of the TaskRun update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: The ARM resource tags.. + * + * @param tags The ARM resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the TaskRun update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: Identity for the resource.. + * + * @param identity Identity for the resource. + * @return the next definition stage. + */ + Update withIdentity(IdentityProperties identity); + } + + /** + * The stage of the TaskRun update allowing to specify runRequest. + */ + interface WithRunRequest { + /** + * Specifies the runRequest property: The request (parameters) for the new run. + * + * @param runRequest The request (parameters) for the new run. + * @return the next definition stage. + */ + Update withRunRequest(RunRequest runRequest); + } + + /** + * The stage of the TaskRun update allowing to specify forceUpdateTag. + */ + interface WithForceUpdateTag { + /** + * Specifies the forceUpdateTag property: How the run should be forced to rerun even if the run request + * configuration has not changed. + * + * @param forceUpdateTag How the run should be forced to rerun even if the run request configuration has not + * changed. + * @return the next definition stage. + */ + Update withForceUpdateTag(String forceUpdateTag); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TaskRun refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TaskRun refresh(Context context); + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @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 detailed information for a given task run that includes all secrets along with {@link Response}. + */ + Response getDetailsWithResponse(Context context); + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @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 detailed information for a given task run that includes all secrets. + */ + TaskRun getDetails(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunProperties.java new file mode 100644 index 000000000000..d7a8bed1b0eb --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunProperties.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner; + +/** + * An immutable client-side representation of TaskRunProperties. + */ +public interface TaskRunProperties { + /** + * Gets the provisioningState property: The provisioning state of this task run. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the runRequest property: The request (parameters) for the run. + * + * @return the runRequest value. + */ + RunRequest runRequest(); + + /** + * Gets the runResult property: The result of this task run. + * + * @return the runResult value. + */ + Run runResult(); + + /** + * Gets the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @return the forceUpdateTag value. + */ + String forceUpdateTag(); + + /** + * Gets the inner com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner object. + * + * @return the inner object. + */ + TaskRunPropertiesInner innerModel(); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunRequest.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunRequest.java new file mode 100644 index 000000000000..a1a920fa2733 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunRequest.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The parameters for a task run request. + */ +@Fluent +public final class TaskRunRequest extends RunRequest { + /* + * The type of the run request. + */ + private String type = "TaskRunRequest"; + + /* + * The resource ID of task against which run has to be queued. + */ + private String taskId; + + /* + * Set of overridable parameters that can be passed when running a Task. + */ + private OverrideTaskStepProperties overrideTaskStepProperties; + + /** + * Creates an instance of TaskRunRequest class. + */ + public TaskRunRequest() { + } + + /** + * Get the type property: The type of the run request. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the taskId property: The resource ID of task against which run has to be queued. + * + * @return the taskId value. + */ + public String taskId() { + return this.taskId; + } + + /** + * Set the taskId property: The resource ID of task against which run has to be queued. + * + * @param taskId the taskId value to set. + * @return the TaskRunRequest object itself. + */ + public TaskRunRequest withTaskId(String taskId) { + this.taskId = taskId; + return this; + } + + /** + * Get the overrideTaskStepProperties property: Set of overridable parameters that can be passed when running a + * Task. + * + * @return the overrideTaskStepProperties value. + */ + public OverrideTaskStepProperties overrideTaskStepProperties() { + return this.overrideTaskStepProperties; + } + + /** + * Set the overrideTaskStepProperties property: Set of overridable parameters that can be passed when running a + * Task. + * + * @param overrideTaskStepProperties the overrideTaskStepProperties value to set. + * @return the TaskRunRequest object itself. + */ + public TaskRunRequest withOverrideTaskStepProperties(OverrideTaskStepProperties overrideTaskStepProperties) { + this.overrideTaskStepProperties = overrideTaskStepProperties; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TaskRunRequest withIsArchiveEnabled(Boolean isArchiveEnabled) { + super.withIsArchiveEnabled(isArchiveEnabled); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TaskRunRequest withAgentPoolName(String agentPoolName) { + super.withAgentPoolName(agentPoolName); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public TaskRunRequest withLogTemplate(String logTemplate) { + super.withLogTemplate(logTemplate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isArchiveEnabled", isArchiveEnabled()); + jsonWriter.writeStringField("agentPoolName", agentPoolName()); + jsonWriter.writeStringField("logTemplate", logTemplate()); + jsonWriter.writeStringField("taskId", this.taskId); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeJsonField("overrideTaskStepProperties", this.overrideTaskStepProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskRunRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskRunRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TaskRunRequest. + */ + public static TaskRunRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskRunRequest deserializedTaskRunRequest = new TaskRunRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isArchiveEnabled".equals(fieldName)) { + deserializedTaskRunRequest.withIsArchiveEnabled(reader.getNullable(JsonReader::getBoolean)); + } else if ("agentPoolName".equals(fieldName)) { + deserializedTaskRunRequest.withAgentPoolName(reader.getString()); + } else if ("logTemplate".equals(fieldName)) { + deserializedTaskRunRequest.withLogTemplate(reader.getString()); + } else if ("taskId".equals(fieldName)) { + deserializedTaskRunRequest.taskId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedTaskRunRequest.type = reader.getString(); + } else if ("overrideTaskStepProperties".equals(fieldName)) { + deserializedTaskRunRequest.overrideTaskStepProperties = OverrideTaskStepProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskRunRequest; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunUpdateParameters.java new file mode 100644 index 000000000000..61b544feb8fb --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunUpdateParameters.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesUpdateParameters; +import java.io.IOException; +import java.util.Map; + +/** + * The parameters for updating a task run. + */ +@Fluent +public final class TaskRunUpdateParameters implements JsonSerializable { + /* + * Identity for the resource. + */ + private IdentityProperties identity; + + /* + * The properties for updating a task run. + */ + private TaskRunPropertiesUpdateParameters innerProperties; + + /* + * The location of the resource + */ + private String location; + + /* + * The ARM resource tags. + */ + private Map tags; + + /** + * Creates an instance of TaskRunUpdateParameters class. + */ + public TaskRunUpdateParameters() { + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the TaskRunUpdateParameters object itself. + */ + public TaskRunUpdateParameters withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: The properties for updating a task run. + * + * @return the innerProperties value. + */ + private TaskRunPropertiesUpdateParameters innerProperties() { + return this.innerProperties; + } + + /** + * Get the location property: The location of the resource. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location of the resource. + * + * @param location the location value to set. + * @return the TaskRunUpdateParameters object itself. + */ + public TaskRunUpdateParameters withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The ARM resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The ARM resource tags. + * + * @param tags the tags value to set. + * @return the TaskRunUpdateParameters object itself. + */ + public TaskRunUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the runRequest property: The request (parameters) for the new run. + * + * @return the runRequest value. + */ + public RunRequest runRequest() { + return this.innerProperties() == null ? null : this.innerProperties().runRequest(); + } + + /** + * Set the runRequest property: The request (parameters) for the new run. + * + * @param runRequest the runRequest value to set. + * @return the TaskRunUpdateParameters object itself. + */ + public TaskRunUpdateParameters withRunRequest(RunRequest runRequest) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskRunPropertiesUpdateParameters(); + } + this.innerProperties().withRunRequest(runRequest); + return this; + } + + /** + * Get the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @return the forceUpdateTag value. + */ + public String forceUpdateTag() { + return this.innerProperties() == null ? null : this.innerProperties().forceUpdateTag(); + } + + /** + * Set the forceUpdateTag property: How the run should be forced to rerun even if the run request configuration has + * not changed. + * + * @param forceUpdateTag the forceUpdateTag value to set. + * @return the TaskRunUpdateParameters object itself. + */ + public TaskRunUpdateParameters withForceUpdateTag(String forceUpdateTag) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskRunPropertiesUpdateParameters(); + } + this.innerProperties().withForceUpdateTag(forceUpdateTag); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskRunUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskRunUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskRunUpdateParameters. + */ + public static TaskRunUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskRunUpdateParameters deserializedTaskRunUpdateParameters = new TaskRunUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedTaskRunUpdateParameters.identity = IdentityProperties.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedTaskRunUpdateParameters.innerProperties + = TaskRunPropertiesUpdateParameters.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedTaskRunUpdateParameters.location = reader.getString(); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTaskRunUpdateParameters.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTaskRunUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRuns.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRuns.java new file mode 100644 index 000000000000..56225562e559 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRuns.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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 TaskRuns. + */ +public interface TaskRuns { + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context); + + /** + * Gets the detailed information for a given task run. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run. + */ + TaskRun get(String resourceGroupName, String registryName, String taskRunName); + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context); + + /** + * Deletes a specified task run resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 delete(String resourceGroupName, String registryName, String taskRunName); + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Lists all the task runs for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of task runs as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName, Context context); + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets along with {@link Response}. + */ + Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskRunName, + Context context); + + /** + * Gets the detailed information for a given task run that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskRunName The name of the task run. + * @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 detailed information for a given task run that includes all secrets. + */ + TaskRun getDetails(String resourceGroupName, String registryName, String taskRunName); + + /** + * Gets the detailed information for a given task run. + * + * @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 the detailed information for a given task run along with {@link Response}. + */ + TaskRun getById(String id); + + /** + * Gets the detailed information for a given task run. + * + * @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 detailed information for a given task run along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified task run resource. + * + * @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 a specified task run resource. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TaskRun resource. + * + * @param name resource name. + * @return the first stage of the new TaskRun definition. + */ + TaskRun.DefinitionStages.Blank define(String name); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStatus.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStatus.java new file mode 100644 index 000000000000..b8d0e1460396 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current status of task. + */ +public final class TaskStatus extends ExpandableStringEnum { + /** + * Static value Disabled for TaskStatus. + */ + public static final TaskStatus DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for TaskStatus. + */ + public static final TaskStatus ENABLED = fromString("Enabled"); + + /** + * Creates a new instance of TaskStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TaskStatus() { + } + + /** + * Creates or finds a TaskStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TaskStatus. + */ + public static TaskStatus fromString(String name) { + return fromString(name, TaskStatus.class); + } + + /** + * Gets known TaskStatus values. + * + * @return known TaskStatus values. + */ + public static Collection values() { + return values(TaskStatus.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepProperties.java new file mode 100644 index 000000000000..a1d33814789b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepProperties.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Base properties for any task step. + */ +@Fluent +public class TaskStepProperties implements JsonSerializable { + /* + * The type of the step. + */ + private StepType type = StepType.fromString("TaskStepProperties"); + + /* + * List of base image dependencies for a step. + */ + private List baseImageDependencies; + + /* + * The URL(absolute or relative) of the source context for the task step. + */ + private String contextPath; + + /* + * The token (git PAT or SAS token of storage account blob) associated with the context for a step. + */ + private String contextAccessToken; + + /** + * Creates an instance of TaskStepProperties class. + */ + public TaskStepProperties() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + public StepType type() { + return this.type; + } + + /** + * Get the baseImageDependencies property: List of base image dependencies for a step. + * + * @return the baseImageDependencies value. + */ + public List baseImageDependencies() { + return this.baseImageDependencies; + } + + /** + * Set the baseImageDependencies property: List of base image dependencies for a step. + * + * @param baseImageDependencies the baseImageDependencies value to set. + * @return the TaskStepProperties object itself. + */ + TaskStepProperties withBaseImageDependencies(List baseImageDependencies) { + this.baseImageDependencies = baseImageDependencies; + return this; + } + + /** + * Get the contextPath property: The URL(absolute or relative) of the source context for the task step. + * + * @return the contextPath value. + */ + public String contextPath() { + return this.contextPath; + } + + /** + * Set the contextPath property: The URL(absolute or relative) of the source context for the task step. + * + * @param contextPath the contextPath value to set. + * @return the TaskStepProperties object itself. + */ + public TaskStepProperties withContextPath(String contextPath) { + this.contextPath = contextPath; + return this; + } + + /** + * Get the contextAccessToken property: The token (git PAT or SAS token of storage account blob) associated with the + * context for a step. + * + * @return the contextAccessToken value. + */ + public String contextAccessToken() { + return this.contextAccessToken; + } + + /** + * Set the contextAccessToken property: The token (git PAT or SAS token of storage account blob) associated with the + * context for a step. + * + * @param contextAccessToken the contextAccessToken value to set. + * @return the TaskStepProperties object itself. + */ + public TaskStepProperties withContextAccessToken(String contextAccessToken) { + this.contextAccessToken = contextAccessToken; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("contextPath", this.contextPath); + jsonWriter.writeStringField("contextAccessToken", this.contextAccessToken); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskStepProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskStepProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskStepProperties. + */ + public static TaskStepProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Docker".equals(discriminatorValue)) { + return DockerBuildStep.fromJson(readerToUse.reset()); + } else if ("FileTask".equals(discriminatorValue)) { + return FileTaskStep.fromJson(readerToUse.reset()); + } else if ("EncodedTask".equals(discriminatorValue)) { + return EncodedTaskStep.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static TaskStepProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskStepProperties deserializedTaskStepProperties = new TaskStepProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedTaskStepProperties.type = StepType.fromString(reader.getString()); + } else if ("baseImageDependencies".equals(fieldName)) { + List baseImageDependencies + = reader.readArray(reader1 -> BaseImageDependency.fromJson(reader1)); + deserializedTaskStepProperties.baseImageDependencies = baseImageDependencies; + } else if ("contextPath".equals(fieldName)) { + deserializedTaskStepProperties.contextPath = reader.getString(); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedTaskStepProperties.contextAccessToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskStepProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepUpdateParameters.java new file mode 100644 index 000000000000..a7230e06499b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepUpdateParameters.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Base properties for updating any task step. + */ +@Fluent +public class TaskStepUpdateParameters implements JsonSerializable { + /* + * The type of the step. + */ + private StepType type = StepType.fromString("TaskStepUpdateParameters"); + + /* + * The URL(absolute or relative) of the source context for the task step. + */ + private String contextPath; + + /* + * The token (git PAT or SAS token of storage account blob) associated with the context for a step. + */ + private String contextAccessToken; + + /** + * Creates an instance of TaskStepUpdateParameters class. + */ + public TaskStepUpdateParameters() { + } + + /** + * Get the type property: The type of the step. + * + * @return the type value. + */ + public StepType type() { + return this.type; + } + + /** + * Get the contextPath property: The URL(absolute or relative) of the source context for the task step. + * + * @return the contextPath value. + */ + public String contextPath() { + return this.contextPath; + } + + /** + * Set the contextPath property: The URL(absolute or relative) of the source context for the task step. + * + * @param contextPath the contextPath value to set. + * @return the TaskStepUpdateParameters object itself. + */ + public TaskStepUpdateParameters withContextPath(String contextPath) { + this.contextPath = contextPath; + return this; + } + + /** + * Get the contextAccessToken property: The token (git PAT or SAS token of storage account blob) associated with the + * context for a step. + * + * @return the contextAccessToken value. + */ + public String contextAccessToken() { + return this.contextAccessToken; + } + + /** + * Set the contextAccessToken property: The token (git PAT or SAS token of storage account blob) associated with the + * context for a step. + * + * @param contextAccessToken the contextAccessToken value to set. + * @return the TaskStepUpdateParameters object itself. + */ + public TaskStepUpdateParameters withContextAccessToken(String contextAccessToken) { + this.contextAccessToken = contextAccessToken; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("contextPath", this.contextPath); + jsonWriter.writeStringField("contextAccessToken", this.contextAccessToken); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskStepUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskStepUpdateParameters if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskStepUpdateParameters. + */ + public static TaskStepUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("type".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Docker".equals(discriminatorValue)) { + return DockerBuildStepUpdateParameters.fromJson(readerToUse.reset()); + } else if ("FileTask".equals(discriminatorValue)) { + return FileTaskStepUpdateParameters.fromJson(readerToUse.reset()); + } else if ("EncodedTask".equals(discriminatorValue)) { + return EncodedTaskStepUpdateParameters.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static TaskStepUpdateParameters fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskStepUpdateParameters deserializedTaskStepUpdateParameters = new TaskStepUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedTaskStepUpdateParameters.type = StepType.fromString(reader.getString()); + } else if ("contextPath".equals(fieldName)) { + deserializedTaskStepUpdateParameters.contextPath = reader.getString(); + } else if ("contextAccessToken".equals(fieldName)) { + deserializedTaskStepUpdateParameters.contextAccessToken = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTaskStepUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskUpdateParameters.java new file mode 100644 index 000000000000..a2275f0f208e --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskUpdateParameters.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskPropertiesUpdateParameters; +import java.io.IOException; +import java.util.Map; + +/** + * The parameters for updating a task. + */ +@Fluent +public final class TaskUpdateParameters implements JsonSerializable { + /* + * Identity for the resource. + */ + private IdentityProperties identity; + + /* + * The properties for updating a task. + */ + private TaskPropertiesUpdateParameters innerProperties; + + /* + * The ARM resource tags. + */ + private Map tags; + + /** + * Creates an instance of TaskUpdateParameters class. + */ + public TaskUpdateParameters() { + } + + /** + * Get the identity property: Identity for the resource. + * + * @return the identity value. + */ + public IdentityProperties identity() { + return this.identity; + } + + /** + * Set the identity property: Identity for the resource. + * + * @param identity the identity value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withIdentity(IdentityProperties identity) { + this.identity = identity; + return this; + } + + /** + * Get the innerProperties property: The properties for updating a task. + * + * @return the innerProperties value. + */ + private TaskPropertiesUpdateParameters innerProperties() { + return this.innerProperties; + } + + /** + * Get the tags property: The ARM resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The ARM resource tags. + * + * @param tags the tags value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the status property: The current status of task. + * + * @return the status value. + */ + public TaskStatus status() { + return this.innerProperties() == null ? null : this.innerProperties().status(); + } + + /** + * Set the status property: The current status of task. + * + * @param status the status value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withStatus(TaskStatus status) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withStatus(status); + return this; + } + + /** + * Get the platform property: The platform properties against which the run has to happen. + * + * @return the platform value. + */ + public PlatformUpdateParameters platform() { + return this.innerProperties() == null ? null : this.innerProperties().platform(); + } + + /** + * Set the platform property: The platform properties against which the run has to happen. + * + * @param platform the platform value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withPlatform(PlatformUpdateParameters platform) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withPlatform(platform); + return this; + } + + /** + * Get the agentConfiguration property: The machine configuration of the run agent. + * + * @return the agentConfiguration value. + */ + public AgentProperties agentConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().agentConfiguration(); + } + + /** + * Set the agentConfiguration property: The machine configuration of the run agent. + * + * @param agentConfiguration the agentConfiguration value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withAgentConfiguration(AgentProperties agentConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withAgentConfiguration(agentConfiguration); + return this; + } + + /** + * Get the agentPoolName property: The dedicated agent pool for the task. + * + * @return the agentPoolName value. + */ + public String agentPoolName() { + return this.innerProperties() == null ? null : this.innerProperties().agentPoolName(); + } + + /** + * Set the agentPoolName property: The dedicated agent pool for the task. + * + * @param agentPoolName the agentPoolName value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withAgentPoolName(String agentPoolName) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withAgentPoolName(agentPoolName); + return this; + } + + /** + * Get the timeout property: Run timeout in seconds. + * + * @return the timeout value. + */ + public Integer timeout() { + return this.innerProperties() == null ? null : this.innerProperties().timeout(); + } + + /** + * Set the timeout property: Run timeout in seconds. + * + * @param timeout the timeout value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withTimeout(Integer timeout) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withTimeout(timeout); + return this; + } + + /** + * Get the step property: The properties for updating a task step. + * + * @return the step value. + */ + public TaskStepUpdateParameters step() { + return this.innerProperties() == null ? null : this.innerProperties().step(); + } + + /** + * Set the step property: The properties for updating a task step. + * + * @param step the step value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withStep(TaskStepUpdateParameters step) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withStep(step); + return this; + } + + /** + * Get the trigger property: The properties for updating trigger properties. + * + * @return the trigger value. + */ + public TriggerUpdateParameters trigger() { + return this.innerProperties() == null ? null : this.innerProperties().trigger(); + } + + /** + * Set the trigger property: The properties for updating trigger properties. + * + * @param trigger the trigger value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withTrigger(TriggerUpdateParameters trigger) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withTrigger(trigger); + return this; + } + + /** + * Get the credentials property: The parameters that describes a set of credentials that will be used when this run + * is invoked. + * + * @return the credentials value. + */ + public Credentials credentials() { + return this.innerProperties() == null ? null : this.innerProperties().credentials(); + } + + /** + * Set the credentials property: The parameters that describes a set of credentials that will be used when this run + * is invoked. + * + * @param credentials the credentials value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withCredentials(Credentials credentials) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withCredentials(credentials); + return this; + } + + /** + * Get the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @return the logTemplate value. + */ + public String logTemplate() { + return this.innerProperties() == null ? null : this.innerProperties().logTemplate(); + } + + /** + * Set the logTemplate property: The template that describes the repository and tag information for run log + * artifact. + * + * @param logTemplate the logTemplate value to set. + * @return the TaskUpdateParameters object itself. + */ + public TaskUpdateParameters withLogTemplate(String logTemplate) { + if (this.innerProperties() == null) { + this.innerProperties = new TaskPropertiesUpdateParameters(); + } + this.innerProperties().withLogTemplate(logTemplate); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TaskUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TaskUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TaskUpdateParameters. + */ + public static TaskUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TaskUpdateParameters deserializedTaskUpdateParameters = new TaskUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedTaskUpdateParameters.identity = IdentityProperties.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedTaskUpdateParameters.innerProperties = TaskPropertiesUpdateParameters.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTaskUpdateParameters.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTaskUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Tasks.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Tasks.java new file mode 100644 index 000000000000..2ce30a1eabb9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Tasks.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.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 Tasks. + */ +public interface Tasks { + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String registryName, String taskName, Context context); + + /** + * Get the properties of a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 properties of a specified task. + */ + Task get(String resourceGroupName, String registryName, String taskName); + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String registryName, String taskName, Context context); + + /** + * Deletes a specified task. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 delete(String resourceGroupName, String registryName, String taskName); + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName); + + /** + * Lists all the tasks for a specified container registry. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @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 collection of tasks as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String registryName, Context context); + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it along with {@link Response}. + */ + Response getDetailsWithResponse(String resourceGroupName, String registryName, String taskName, + Context context); + + /** + * Returns a task with extended information that includes all secrets. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param registryName The name of the Registry. + * @param taskName The name of the container registry task. + * @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 task that has the ARM resource and task properties. + * The task will have all information to schedule a run against it. + */ + Task getDetails(String resourceGroupName, String registryName, String taskName); + + /** + * Get the properties of a specified task. + * + * @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 the properties of a specified task along with {@link Response}. + */ + Task getById(String id); + + /** + * Get the properties of a specified task. + * + * @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 properties of a specified task along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a specified task. + * + * @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 a specified task. + * + * @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 {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Task resource. + * + * @param name resource name. + * @return the first stage of the new Task definition. + */ + Task.DefinitionStages.Blank define(String name); +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTrigger.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTrigger.java new file mode 100644 index 000000000000..bc3ca27c6e97 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTrigger.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a timer trigger. + */ +@Fluent +public final class TimerTrigger implements JsonSerializable { + /* + * The CRON expression for the task schedule + */ + private String schedule; + + /* + * The current status of trigger. + */ + private TriggerStatus status; + + /* + * The name of the trigger. + */ + private String name; + + /** + * Creates an instance of TimerTrigger class. + */ + public TimerTrigger() { + } + + /** + * Get the schedule property: The CRON expression for the task schedule. + * + * @return the schedule value. + */ + public String schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The CRON expression for the task schedule. + * + * @param schedule the schedule value to set. + * @return the TimerTrigger object itself. + */ + public TimerTrigger withSchedule(String schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the status property: The current status of trigger. + * + * @return the status value. + */ + public TriggerStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of trigger. + * + * @param status the status value to set. + * @return the TimerTrigger object itself. + */ + public TimerTrigger withStatus(TriggerStatus status) { + this.status = status; + return this; + } + + /** + * Get the name property: The name of the trigger. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the trigger. + * + * @param name the name value to set. + * @return the TimerTrigger object itself. + */ + public TimerTrigger withName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("schedule", this.schedule); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimerTrigger from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimerTrigger if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TimerTrigger. + */ + public static TimerTrigger fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimerTrigger deserializedTimerTrigger = new TimerTrigger(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("schedule".equals(fieldName)) { + deserializedTimerTrigger.schedule = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedTimerTrigger.name = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedTimerTrigger.status = TriggerStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTimerTrigger; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerDescriptor.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerDescriptor.java new file mode 100644 index 000000000000..4d2bd562884d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerDescriptor.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The TimerTriggerDescriptor model. + */ +@Immutable +public final class TimerTriggerDescriptor implements JsonSerializable { + /* + * The timer trigger name that caused the run. + */ + private String timerTriggerName; + + /* + * The occurrence that triggered the run. + */ + private String scheduleOccurrence; + + /** + * Creates an instance of TimerTriggerDescriptor class. + */ + private TimerTriggerDescriptor() { + } + + /** + * Get the timerTriggerName property: The timer trigger name that caused the run. + * + * @return the timerTriggerName value. + */ + public String timerTriggerName() { + return this.timerTriggerName; + } + + /** + * Get the scheduleOccurrence property: The occurrence that triggered the run. + * + * @return the scheduleOccurrence value. + */ + public String scheduleOccurrence() { + return this.scheduleOccurrence; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("timerTriggerName", this.timerTriggerName); + jsonWriter.writeStringField("scheduleOccurrence", this.scheduleOccurrence); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimerTriggerDescriptor from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimerTriggerDescriptor if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TimerTriggerDescriptor. + */ + public static TimerTriggerDescriptor fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimerTriggerDescriptor deserializedTimerTriggerDescriptor = new TimerTriggerDescriptor(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timerTriggerName".equals(fieldName)) { + deserializedTimerTriggerDescriptor.timerTriggerName = reader.getString(); + } else if ("scheduleOccurrence".equals(fieldName)) { + deserializedTimerTriggerDescriptor.scheduleOccurrence = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTimerTriggerDescriptor; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerUpdateParameters.java new file mode 100644 index 000000000000..8e83725dea4f --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerUpdateParameters.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties for updating a timer trigger. + */ +@Fluent +public final class TimerTriggerUpdateParameters implements JsonSerializable { + /* + * The CRON expression for the task schedule + */ + private String schedule; + + /* + * The current status of trigger. + */ + private TriggerStatus status; + + /* + * The name of the trigger. + */ + private String name; + + /** + * Creates an instance of TimerTriggerUpdateParameters class. + */ + public TimerTriggerUpdateParameters() { + } + + /** + * Get the schedule property: The CRON expression for the task schedule. + * + * @return the schedule value. + */ + public String schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The CRON expression for the task schedule. + * + * @param schedule the schedule value to set. + * @return the TimerTriggerUpdateParameters object itself. + */ + public TimerTriggerUpdateParameters withSchedule(String schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the status property: The current status of trigger. + * + * @return the status value. + */ + public TriggerStatus status() { + return this.status; + } + + /** + * Set the status property: The current status of trigger. + * + * @param status the status value to set. + * @return the TimerTriggerUpdateParameters object itself. + */ + public TimerTriggerUpdateParameters withStatus(TriggerStatus status) { + this.status = status; + return this; + } + + /** + * Get the name property: The name of the trigger. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the trigger. + * + * @param name the name value to set. + * @return the TimerTriggerUpdateParameters object itself. + */ + public TimerTriggerUpdateParameters withName(String name) { + this.name = name; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("schedule", this.schedule); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimerTriggerUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimerTriggerUpdateParameters if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the TimerTriggerUpdateParameters. + */ + public static TimerTriggerUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimerTriggerUpdateParameters deserializedTimerTriggerUpdateParameters = new TimerTriggerUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedTimerTriggerUpdateParameters.name = reader.getString(); + } else if ("schedule".equals(fieldName)) { + deserializedTimerTriggerUpdateParameters.schedule = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedTimerTriggerUpdateParameters.status = TriggerStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTimerTriggerUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TokenType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TokenType.java new file mode 100644 index 000000000000..4490d56eb073 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TokenType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of Auth token. + */ +public final class TokenType extends ExpandableStringEnum { + /** + * Static value PAT for TokenType. + */ + public static final TokenType PAT = fromString("PAT"); + + /** + * Static value OAuth for TokenType. + */ + public static final TokenType OAUTH = fromString("OAuth"); + + /** + * Creates a new instance of TokenType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TokenType() { + } + + /** + * Creates or finds a TokenType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TokenType. + */ + public static TokenType fromString(String name) { + return fromString(name, TokenType.class); + } + + /** + * Gets known TokenType values. + * + * @return known TokenType values. + */ + public static Collection values() { + return values(TokenType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerProperties.java new file mode 100644 index 000000000000..cf6543f5309c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties of a trigger. + */ +@Fluent +public final class TriggerProperties implements JsonSerializable { + /* + * The collection of timer triggers. + */ + private List timerTriggers; + + /* + * The collection of triggers based on source code repository. + */ + private List sourceTriggers; + + /* + * The trigger based on base image dependencies. + */ + private BaseImageTrigger baseImageTrigger; + + /** + * Creates an instance of TriggerProperties class. + */ + public TriggerProperties() { + } + + /** + * Get the timerTriggers property: The collection of timer triggers. + * + * @return the timerTriggers value. + */ + public List timerTriggers() { + return this.timerTriggers; + } + + /** + * Set the timerTriggers property: The collection of timer triggers. + * + * @param timerTriggers the timerTriggers value to set. + * @return the TriggerProperties object itself. + */ + public TriggerProperties withTimerTriggers(List timerTriggers) { + this.timerTriggers = timerTriggers; + return this; + } + + /** + * Get the sourceTriggers property: The collection of triggers based on source code repository. + * + * @return the sourceTriggers value. + */ + public List sourceTriggers() { + return this.sourceTriggers; + } + + /** + * Set the sourceTriggers property: The collection of triggers based on source code repository. + * + * @param sourceTriggers the sourceTriggers value to set. + * @return the TriggerProperties object itself. + */ + public TriggerProperties withSourceTriggers(List sourceTriggers) { + this.sourceTriggers = sourceTriggers; + return this; + } + + /** + * Get the baseImageTrigger property: The trigger based on base image dependencies. + * + * @return the baseImageTrigger value. + */ + public BaseImageTrigger baseImageTrigger() { + return this.baseImageTrigger; + } + + /** + * Set the baseImageTrigger property: The trigger based on base image dependencies. + * + * @param baseImageTrigger the baseImageTrigger value to set. + * @return the TriggerProperties object itself. + */ + public TriggerProperties withBaseImageTrigger(BaseImageTrigger baseImageTrigger) { + this.baseImageTrigger = baseImageTrigger; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("timerTriggers", this.timerTriggers, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("sourceTriggers", this.sourceTriggers, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("baseImageTrigger", this.baseImageTrigger); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TriggerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TriggerProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TriggerProperties. + */ + public static TriggerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TriggerProperties deserializedTriggerProperties = new TriggerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timerTriggers".equals(fieldName)) { + List timerTriggers = reader.readArray(reader1 -> TimerTrigger.fromJson(reader1)); + deserializedTriggerProperties.timerTriggers = timerTriggers; + } else if ("sourceTriggers".equals(fieldName)) { + List sourceTriggers = reader.readArray(reader1 -> SourceTrigger.fromJson(reader1)); + deserializedTriggerProperties.sourceTriggers = sourceTriggers; + } else if ("baseImageTrigger".equals(fieldName)) { + deserializedTriggerProperties.baseImageTrigger = BaseImageTrigger.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTriggerProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerStatus.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerStatus.java new file mode 100644 index 000000000000..0ba4d05d171f --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current status of trigger. + */ +public final class TriggerStatus extends ExpandableStringEnum { + /** + * Static value Disabled for TriggerStatus. + */ + public static final TriggerStatus DISABLED = fromString("Disabled"); + + /** + * Static value Enabled for TriggerStatus. + */ + public static final TriggerStatus ENABLED = fromString("Enabled"); + + /** + * Creates a new instance of TriggerStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TriggerStatus() { + } + + /** + * Creates or finds a TriggerStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding TriggerStatus. + */ + public static TriggerStatus fromString(String name) { + return fromString(name, TriggerStatus.class); + } + + /** + * Gets known TriggerStatus values. + * + * @return known TriggerStatus values. + */ + public static Collection values() { + return values(TriggerStatus.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerUpdateParameters.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerUpdateParameters.java new file mode 100644 index 000000000000..06c54d90b268 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerUpdateParameters.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The properties for updating triggers. + */ +@Fluent +public final class TriggerUpdateParameters implements JsonSerializable { + /* + * The collection of timer triggers. + */ + private List timerTriggers; + + /* + * The collection of triggers based on source code repository. + */ + private List sourceTriggers; + + /* + * The trigger based on base image dependencies. + */ + private BaseImageTriggerUpdateParameters baseImageTrigger; + + /** + * Creates an instance of TriggerUpdateParameters class. + */ + public TriggerUpdateParameters() { + } + + /** + * Get the timerTriggers property: The collection of timer triggers. + * + * @return the timerTriggers value. + */ + public List timerTriggers() { + return this.timerTriggers; + } + + /** + * Set the timerTriggers property: The collection of timer triggers. + * + * @param timerTriggers the timerTriggers value to set. + * @return the TriggerUpdateParameters object itself. + */ + public TriggerUpdateParameters withTimerTriggers(List timerTriggers) { + this.timerTriggers = timerTriggers; + return this; + } + + /** + * Get the sourceTriggers property: The collection of triggers based on source code repository. + * + * @return the sourceTriggers value. + */ + public List sourceTriggers() { + return this.sourceTriggers; + } + + /** + * Set the sourceTriggers property: The collection of triggers based on source code repository. + * + * @param sourceTriggers the sourceTriggers value to set. + * @return the TriggerUpdateParameters object itself. + */ + public TriggerUpdateParameters withSourceTriggers(List sourceTriggers) { + this.sourceTriggers = sourceTriggers; + return this; + } + + /** + * Get the baseImageTrigger property: The trigger based on base image dependencies. + * + * @return the baseImageTrigger value. + */ + public BaseImageTriggerUpdateParameters baseImageTrigger() { + return this.baseImageTrigger; + } + + /** + * Set the baseImageTrigger property: The trigger based on base image dependencies. + * + * @param baseImageTrigger the baseImageTrigger value to set. + * @return the TriggerUpdateParameters object itself. + */ + public TriggerUpdateParameters withBaseImageTrigger(BaseImageTriggerUpdateParameters baseImageTrigger) { + this.baseImageTrigger = baseImageTrigger; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("timerTriggers", this.timerTriggers, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("sourceTriggers", this.sourceTriggers, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeJsonField("baseImageTrigger", this.baseImageTrigger); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TriggerUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TriggerUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the TriggerUpdateParameters. + */ + public static TriggerUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TriggerUpdateParameters deserializedTriggerUpdateParameters = new TriggerUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("timerTriggers".equals(fieldName)) { + List timerTriggers + = reader.readArray(reader1 -> TimerTriggerUpdateParameters.fromJson(reader1)); + deserializedTriggerUpdateParameters.timerTriggers = timerTriggers; + } else if ("sourceTriggers".equals(fieldName)) { + List sourceTriggers + = reader.readArray(reader1 -> SourceTriggerUpdateParameters.fromJson(reader1)); + deserializedTriggerUpdateParameters.sourceTriggers = sourceTriggers; + } else if ("baseImageTrigger".equals(fieldName)) { + deserializedTriggerUpdateParameters.baseImageTrigger + = BaseImageTriggerUpdateParameters.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedTriggerUpdateParameters; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UpdateTriggerPayloadType.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UpdateTriggerPayloadType.java new file mode 100644 index 000000000000..4b85381e3ca3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UpdateTriggerPayloadType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of Payload body for Base image update triggers. + */ +public final class UpdateTriggerPayloadType extends ExpandableStringEnum { + /** + * Static value Default for UpdateTriggerPayloadType. + */ + public static final UpdateTriggerPayloadType DEFAULT = fromString("Default"); + + /** + * Static value Token for UpdateTriggerPayloadType. + */ + public static final UpdateTriggerPayloadType TOKEN = fromString("Token"); + + /** + * Creates a new instance of UpdateTriggerPayloadType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UpdateTriggerPayloadType() { + } + + /** + * Creates or finds a UpdateTriggerPayloadType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpdateTriggerPayloadType. + */ + public static UpdateTriggerPayloadType fromString(String name) { + return fromString(name, UpdateTriggerPayloadType.class); + } + + /** + * Gets known UpdateTriggerPayloadType values. + * + * @return known UpdateTriggerPayloadType values. + */ + public static Collection values() { + return values(UpdateTriggerPayloadType.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UserIdentityProperties.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UserIdentityProperties.java new file mode 100644 index 000000000000..562ad422d059 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UserIdentityProperties.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The UserIdentityProperties model. + */ +@Immutable +public final class UserIdentityProperties implements JsonSerializable { + /* + * The principal id of user assigned identity. + */ + private String principalId; + + /* + * The client id of user assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserIdentityProperties class. + */ + public UserIdentityProperties() { + } + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserIdentityProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserIdentityProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserIdentityProperties. + */ + public static UserIdentityProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserIdentityProperties deserializedUserIdentityProperties = new UserIdentityProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserIdentityProperties.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserIdentityProperties.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserIdentityProperties; + }); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Variant.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Variant.java new file mode 100644 index 000000000000..7f65f3b2f2e8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Variant.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Variant of the CPU. + */ +public final class Variant extends ExpandableStringEnum { + /** + * Static value v6 for Variant. + */ + public static final Variant V6 = fromString("v6"); + + /** + * Static value v7 for Variant. + */ + public static final Variant V7 = fromString("v7"); + + /** + * Static value v8 for Variant. + */ + public static final Variant V8 = fromString("v8"); + + /** + * Creates a new instance of Variant value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Variant() { + } + + /** + * Creates or finds a Variant from its string representation. + * + * @param name a name to look for. + * @return the corresponding Variant. + */ + public static Variant fromString(String name) { + return fromString(name, Variant.class); + } + + /** + * Gets known Variant values. + * + * @return known Variant values. + */ + public static Collection values() { + return values(Variant.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/package-info.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/package-info.java new file mode 100644 index 000000000000..84aeab69f9f1 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for ContainerRegistryTasks. + * The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for + * Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry + * components. + */ +package com.azure.resourcemanager.containerregistry.tasks.models; diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/package-info.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/package-info.java new file mode 100644 index 000000000000..2e9b85187f2d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/com/azure/resourcemanager/containerregistry/tasks/package-info.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for ContainerRegistryTasks. + * The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for + * Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry + * components. + */ +package com.azure.resourcemanager.containerregistry.tasks; diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/module-info.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/module-info.java new file mode 100644 index 000000000000..ef27356145d7 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.containerregistry.tasks { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.containerregistry.tasks; + exports com.azure.resourcemanager.containerregistry.tasks.fluent; + exports com.azure.resourcemanager.containerregistry.tasks.fluent.models; + exports com.azure.resourcemanager.containerregistry.tasks.models; + + opens com.azure.resourcemanager.containerregistry.tasks.fluent.models to com.azure.core; + opens com.azure.resourcemanager.containerregistry.tasks.models to com.azure.core; + opens com.azure.resourcemanager.containerregistry.tasks.implementation.models to com.azure.core; +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/azure-resourcemanager-containerregistry-tasks_apiview_properties.json b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/azure-resourcemanager-containerregistry-tasks_apiview_properties.json new file mode 100644 index 000000000000..718b41d248d9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/azure-resourcemanager-containerregistry-tasks_apiview_properties.json @@ -0,0 +1,140 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient": "Microsoft.ContainerRegistry.AgentPools", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.beginCreate": "Microsoft.ContainerRegistry.AgentPools.create", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.beginDelete": "Microsoft.ContainerRegistry.AgentPools.delete", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.beginUpdate": "Microsoft.ContainerRegistry.AgentPools.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.create": "Microsoft.ContainerRegistry.AgentPools.create", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.delete": "Microsoft.ContainerRegistry.AgentPools.delete", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.get": "Microsoft.ContainerRegistry.AgentPools.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.getQueueStatus": "Microsoft.ContainerRegistry.AgentPools.getQueueStatus", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.getQueueStatusWithResponse": "Microsoft.ContainerRegistry.AgentPools.getQueueStatus", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.getWithResponse": "Microsoft.ContainerRegistry.AgentPools.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.list": "Microsoft.ContainerRegistry.AgentPools.list", + "com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.update": "Microsoft.ContainerRegistry.AgentPools.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.ContainerRegistryTasksManagementClient": "Microsoft.ContainerRegistry", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient": "Microsoft.ContainerRegistry.Registries", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.getBuildSourceUploadUrl": "Microsoft.ContainerRegistry.Registries.getBuildSourceUploadUrl", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.getBuildSourceUploadUrlWithResponse": "Microsoft.ContainerRegistry.Registries.getBuildSourceUploadUrl", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.scheduleRun": "Microsoft.ContainerRegistry.Registries.scheduleRun", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.scheduleRunWithResponse": "Microsoft.ContainerRegistry.Registries.scheduleRun", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient": "Microsoft.ContainerRegistry.Runs", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.cancel": "Microsoft.ContainerRegistry.Runs.cancel", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.cancelWithResponse": "Microsoft.ContainerRegistry.Runs.cancel", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.get": "Microsoft.ContainerRegistry.Runs.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.getLogSasUrl": "Microsoft.ContainerRegistry.Runs.getLogSasUrl", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.getLogSasUrlWithResponse": "Microsoft.ContainerRegistry.Runs.getLogSasUrl", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.getWithResponse": "Microsoft.ContainerRegistry.Runs.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.list": "Microsoft.ContainerRegistry.Runs.list", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.update": "Microsoft.ContainerRegistry.Runs.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.updateWithResponse": "Microsoft.ContainerRegistry.Runs.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient": "Microsoft.ContainerRegistry.TaskRuns", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.beginCreate": "Microsoft.ContainerRegistry.TaskRuns.create", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.beginUpdate": "Microsoft.ContainerRegistry.TaskRuns.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.create": "Microsoft.ContainerRegistry.TaskRuns.create", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.delete": "Microsoft.ContainerRegistry.TaskRuns.delete", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.deleteWithResponse": "Microsoft.ContainerRegistry.TaskRuns.delete", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.get": "Microsoft.ContainerRegistry.TaskRuns.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.getDetails": "Microsoft.ContainerRegistry.TaskRuns.getDetails", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.getDetailsWithResponse": "Microsoft.ContainerRegistry.TaskRuns.getDetails", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.getWithResponse": "Microsoft.ContainerRegistry.TaskRuns.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.list": "Microsoft.ContainerRegistry.TaskRuns.list", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.update": "Microsoft.ContainerRegistry.TaskRuns.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient": "Microsoft.ContainerRegistry.Tasks", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.create": "Microsoft.ContainerRegistry.Tasks.create", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.createWithResponse": "Microsoft.ContainerRegistry.Tasks.create", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.delete": "Microsoft.ContainerRegistry.Tasks.delete", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.deleteWithResponse": "Microsoft.ContainerRegistry.Tasks.delete", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.get": "Microsoft.ContainerRegistry.Tasks.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.getDetails": "Microsoft.ContainerRegistry.Tasks.getDetails", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.getDetailsWithResponse": "Microsoft.ContainerRegistry.Tasks.getDetails", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.getWithResponse": "Microsoft.ContainerRegistry.Tasks.get", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.list": "Microsoft.ContainerRegistry.Tasks.list", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.update": "Microsoft.ContainerRegistry.Tasks.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.updateWithResponse": "Microsoft.ContainerRegistry.Tasks.update", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner": "Microsoft.ContainerRegistry.AgentPool", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolPropertiesUpdateParameters": "Microsoft.ContainerRegistry.AgentPoolPropertiesUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner": "Microsoft.ContainerRegistry.AgentPoolQueueStatus", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner": "Microsoft.ContainerRegistry.RunGetLogResult", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner": "Microsoft.ContainerRegistry.Run", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner": "Microsoft.ContainerRegistry.SourceUploadDefinition", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner": "Microsoft.ContainerRegistry.Task", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskPropertiesUpdateParameters": "Microsoft.ContainerRegistry.TaskPropertiesUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner": "Microsoft.ContainerRegistry.TaskRun", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner": "Microsoft.ContainerRegistry.TaskRunProperties", + "com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesUpdateParameters": "Microsoft.ContainerRegistry.TaskRunPropertiesUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.implementation.ContainerRegistryTasksManagementClientBuilder": "Microsoft.ContainerRegistry", + "com.azure.resourcemanager.containerregistry.tasks.implementation.models.AgentPoolListResult": "Microsoft.ContainerRegistry.AgentPoolListResult", + "com.azure.resourcemanager.containerregistry.tasks.implementation.models.RunListResult": "Microsoft.ContainerRegistry.RunListResult", + "com.azure.resourcemanager.containerregistry.tasks.implementation.models.TaskListResult": "Microsoft.ContainerRegistry.TaskListResult", + "com.azure.resourcemanager.containerregistry.tasks.implementation.models.TaskRunListResult": "Microsoft.ContainerRegistry.TaskRunListResult", + "com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties": "Microsoft.ContainerRegistry.AgentPoolProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolUpdateParameters": "Microsoft.ContainerRegistry.AgentPoolUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties": "Microsoft.ContainerRegistry.AgentProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.Architecture": "Microsoft.ContainerRegistry.Architecture", + "com.azure.resourcemanager.containerregistry.tasks.models.Argument": "Microsoft.ContainerRegistry.Argument", + "com.azure.resourcemanager.containerregistry.tasks.models.AuthInfo": "Microsoft.ContainerRegistry.AuthInfo", + "com.azure.resourcemanager.containerregistry.tasks.models.AuthInfoUpdateParameters": "Microsoft.ContainerRegistry.AuthInfoUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.BaseImageDependency": "Microsoft.ContainerRegistry.BaseImageDependency", + "com.azure.resourcemanager.containerregistry.tasks.models.BaseImageDependencyType": "Microsoft.ContainerRegistry.BaseImageDependencyType", + "com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTrigger": "Microsoft.ContainerRegistry.BaseImageTrigger", + "com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerType": "Microsoft.ContainerRegistry.BaseImageTriggerType", + "com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerUpdateParameters": "Microsoft.ContainerRegistry.BaseImageTriggerUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.Credentials": "Microsoft.ContainerRegistry.Credentials", + "com.azure.resourcemanager.containerregistry.tasks.models.CustomRegistryCredentials": "Microsoft.ContainerRegistry.CustomRegistryCredentials", + "com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildRequest": "Microsoft.ContainerRegistry.DockerBuildRequest", + "com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStep": "Microsoft.ContainerRegistry.DockerBuildStep", + "com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStepUpdateParameters": "Microsoft.ContainerRegistry.DockerBuildStepUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest": "Microsoft.ContainerRegistry.EncodedTaskRunRequest", + "com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskStep": "Microsoft.ContainerRegistry.EncodedTaskStep", + "com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskStepUpdateParameters": "Microsoft.ContainerRegistry.EncodedTaskStepUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.FileTaskRunRequest": "Microsoft.ContainerRegistry.FileTaskRunRequest", + "com.azure.resourcemanager.containerregistry.tasks.models.FileTaskStep": "Microsoft.ContainerRegistry.FileTaskStep", + "com.azure.resourcemanager.containerregistry.tasks.models.FileTaskStepUpdateParameters": "Microsoft.ContainerRegistry.FileTaskStepUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties": "Microsoft.ContainerRegistry.IdentityProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.ImageDescriptor": "Microsoft.ContainerRegistry.ImageDescriptor", + "com.azure.resourcemanager.containerregistry.tasks.models.ImageUpdateTrigger": "Microsoft.ContainerRegistry.ImageUpdateTrigger", + "com.azure.resourcemanager.containerregistry.tasks.models.OS": "Microsoft.ContainerRegistry.OS", + "com.azure.resourcemanager.containerregistry.tasks.models.OverrideTaskStepProperties": "Microsoft.ContainerRegistry.OverrideTaskStepProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties": "Microsoft.ContainerRegistry.PlatformProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.PlatformUpdateParameters": "Microsoft.ContainerRegistry.PlatformUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.ProvisioningState": "Microsoft.ContainerRegistry.ProvisioningState", + "com.azure.resourcemanager.containerregistry.tasks.models.ResourceIdentityType": "Microsoft.ContainerRegistry.ResourceIdentityType", + "com.azure.resourcemanager.containerregistry.tasks.models.RunProperties": "Microsoft.ContainerRegistry.RunProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.RunRequest": "Microsoft.ContainerRegistry.RunRequest", + "com.azure.resourcemanager.containerregistry.tasks.models.RunStatus": "Microsoft.ContainerRegistry.RunStatus", + "com.azure.resourcemanager.containerregistry.tasks.models.RunType": "Microsoft.ContainerRegistry.RunType", + "com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters": "Microsoft.ContainerRegistry.RunUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.SecretObject": "Microsoft.ContainerRegistry.SecretObject", + "com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType": "Microsoft.ContainerRegistry.SecretObjectType", + "com.azure.resourcemanager.containerregistry.tasks.models.SetValue": "Microsoft.ContainerRegistry.SetValue", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceControlType": "Microsoft.ContainerRegistry.SourceControlType", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceProperties": "Microsoft.ContainerRegistry.SourceProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials": "Microsoft.ContainerRegistry.SourceRegistryCredentials", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryLoginMode": "Microsoft.ContainerRegistry.SourceRegistryLoginMode", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceTrigger": "Microsoft.ContainerRegistry.SourceTrigger", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerDescriptor": "Microsoft.ContainerRegistry.SourceTriggerDescriptor", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerEvent": "Microsoft.ContainerRegistry.SourceTriggerEvent", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerUpdateParameters": "Microsoft.ContainerRegistry.SourceTriggerUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.SourceUpdateParameters": "Microsoft.ContainerRegistry.SourceUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.StepType": "Microsoft.ContainerRegistry.StepType", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskProperties": "Microsoft.ContainerRegistry.TaskProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskRunRequest": "Microsoft.ContainerRegistry.TaskRunRequest", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskRunUpdateParameters": "Microsoft.ContainerRegistry.TaskRunUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus": "Microsoft.ContainerRegistry.TaskStatus", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskStepProperties": "Microsoft.ContainerRegistry.TaskStepProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskStepUpdateParameters": "Microsoft.ContainerRegistry.TaskStepUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.TaskUpdateParameters": "Microsoft.ContainerRegistry.TaskUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.TimerTrigger": "Microsoft.ContainerRegistry.TimerTrigger", + "com.azure.resourcemanager.containerregistry.tasks.models.TimerTriggerDescriptor": "Microsoft.ContainerRegistry.TimerTriggerDescriptor", + "com.azure.resourcemanager.containerregistry.tasks.models.TimerTriggerUpdateParameters": "Microsoft.ContainerRegistry.TimerTriggerUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.TokenType": "Microsoft.ContainerRegistry.TokenType", + "com.azure.resourcemanager.containerregistry.tasks.models.TriggerProperties": "Microsoft.ContainerRegistry.TriggerProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.TriggerStatus": "Microsoft.ContainerRegistry.TriggerStatus", + "com.azure.resourcemanager.containerregistry.tasks.models.TriggerUpdateParameters": "Microsoft.ContainerRegistry.TriggerUpdateParameters", + "com.azure.resourcemanager.containerregistry.tasks.models.UpdateTriggerPayloadType": "Microsoft.ContainerRegistry.UpdateTriggerPayloadType", + "com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties": "Microsoft.ContainerRegistry.UserIdentityProperties", + "com.azure.resourcemanager.containerregistry.tasks.models.Variant": "Microsoft.ContainerRegistry.Variant" + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/azure-resourcemanager-containerregistry-tasks_metadata.json b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/azure-resourcemanager-containerregistry-tasks_metadata.json new file mode 100644 index 000000000000..8cd119d68a9c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/azure-resourcemanager-containerregistry-tasks_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"2025-03-01-preview","crossLanguageDefinitions":{"com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient":"Microsoft.ContainerRegistry.AgentPools","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.beginCreate":"Microsoft.ContainerRegistry.AgentPools.create","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.beginDelete":"Microsoft.ContainerRegistry.AgentPools.delete","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.beginUpdate":"Microsoft.ContainerRegistry.AgentPools.update","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.create":"Microsoft.ContainerRegistry.AgentPools.create","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.delete":"Microsoft.ContainerRegistry.AgentPools.delete","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.get":"Microsoft.ContainerRegistry.AgentPools.get","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.getQueueStatus":"Microsoft.ContainerRegistry.AgentPools.getQueueStatus","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.getQueueStatusWithResponse":"Microsoft.ContainerRegistry.AgentPools.getQueueStatus","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.getWithResponse":"Microsoft.ContainerRegistry.AgentPools.get","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.list":"Microsoft.ContainerRegistry.AgentPools.list","com.azure.resourcemanager.containerregistry.tasks.fluent.AgentPoolsClient.update":"Microsoft.ContainerRegistry.AgentPools.update","com.azure.resourcemanager.containerregistry.tasks.fluent.ContainerRegistryTasksManagementClient":"Microsoft.ContainerRegistry","com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient":"Microsoft.ContainerRegistry.Registries","com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.getBuildSourceUploadUrl":"Microsoft.ContainerRegistry.Registries.getBuildSourceUploadUrl","com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.getBuildSourceUploadUrlWithResponse":"Microsoft.ContainerRegistry.Registries.getBuildSourceUploadUrl","com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.scheduleRun":"Microsoft.ContainerRegistry.Registries.scheduleRun","com.azure.resourcemanager.containerregistry.tasks.fluent.RegistriesClient.scheduleRunWithResponse":"Microsoft.ContainerRegistry.Registries.scheduleRun","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient":"Microsoft.ContainerRegistry.Runs","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.cancel":"Microsoft.ContainerRegistry.Runs.cancel","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.cancelWithResponse":"Microsoft.ContainerRegistry.Runs.cancel","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.get":"Microsoft.ContainerRegistry.Runs.get","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.getLogSasUrl":"Microsoft.ContainerRegistry.Runs.getLogSasUrl","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.getLogSasUrlWithResponse":"Microsoft.ContainerRegistry.Runs.getLogSasUrl","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.getWithResponse":"Microsoft.ContainerRegistry.Runs.get","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.list":"Microsoft.ContainerRegistry.Runs.list","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.update":"Microsoft.ContainerRegistry.Runs.update","com.azure.resourcemanager.containerregistry.tasks.fluent.RunsClient.updateWithResponse":"Microsoft.ContainerRegistry.Runs.update","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient":"Microsoft.ContainerRegistry.TaskRuns","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.beginCreate":"Microsoft.ContainerRegistry.TaskRuns.create","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.beginUpdate":"Microsoft.ContainerRegistry.TaskRuns.update","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.create":"Microsoft.ContainerRegistry.TaskRuns.create","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.delete":"Microsoft.ContainerRegistry.TaskRuns.delete","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.deleteWithResponse":"Microsoft.ContainerRegistry.TaskRuns.delete","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.get":"Microsoft.ContainerRegistry.TaskRuns.get","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.getDetails":"Microsoft.ContainerRegistry.TaskRuns.getDetails","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.getDetailsWithResponse":"Microsoft.ContainerRegistry.TaskRuns.getDetails","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.getWithResponse":"Microsoft.ContainerRegistry.TaskRuns.get","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.list":"Microsoft.ContainerRegistry.TaskRuns.list","com.azure.resourcemanager.containerregistry.tasks.fluent.TaskRunsClient.update":"Microsoft.ContainerRegistry.TaskRuns.update","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient":"Microsoft.ContainerRegistry.Tasks","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.create":"Microsoft.ContainerRegistry.Tasks.create","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.createWithResponse":"Microsoft.ContainerRegistry.Tasks.create","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.delete":"Microsoft.ContainerRegistry.Tasks.delete","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.deleteWithResponse":"Microsoft.ContainerRegistry.Tasks.delete","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.get":"Microsoft.ContainerRegistry.Tasks.get","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.getDetails":"Microsoft.ContainerRegistry.Tasks.getDetails","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.getDetailsWithResponse":"Microsoft.ContainerRegistry.Tasks.getDetails","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.getWithResponse":"Microsoft.ContainerRegistry.Tasks.get","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.list":"Microsoft.ContainerRegistry.Tasks.list","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.update":"Microsoft.ContainerRegistry.Tasks.update","com.azure.resourcemanager.containerregistry.tasks.fluent.TasksClient.updateWithResponse":"Microsoft.ContainerRegistry.Tasks.update","com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner":"Microsoft.ContainerRegistry.AgentPool","com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolPropertiesUpdateParameters":"Microsoft.ContainerRegistry.AgentPoolPropertiesUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner":"Microsoft.ContainerRegistry.AgentPoolQueueStatus","com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner":"Microsoft.ContainerRegistry.RunGetLogResult","com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunInner":"Microsoft.ContainerRegistry.Run","com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner":"Microsoft.ContainerRegistry.SourceUploadDefinition","com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskInner":"Microsoft.ContainerRegistry.Task","com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskPropertiesUpdateParameters":"Microsoft.ContainerRegistry.TaskPropertiesUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunInner":"Microsoft.ContainerRegistry.TaskRun","com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner":"Microsoft.ContainerRegistry.TaskRunProperties","com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesUpdateParameters":"Microsoft.ContainerRegistry.TaskRunPropertiesUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.implementation.ContainerRegistryTasksManagementClientBuilder":"Microsoft.ContainerRegistry","com.azure.resourcemanager.containerregistry.tasks.implementation.models.AgentPoolListResult":"Microsoft.ContainerRegistry.AgentPoolListResult","com.azure.resourcemanager.containerregistry.tasks.implementation.models.RunListResult":"Microsoft.ContainerRegistry.RunListResult","com.azure.resourcemanager.containerregistry.tasks.implementation.models.TaskListResult":"Microsoft.ContainerRegistry.TaskListResult","com.azure.resourcemanager.containerregistry.tasks.implementation.models.TaskRunListResult":"Microsoft.ContainerRegistry.TaskRunListResult","com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties":"Microsoft.ContainerRegistry.AgentPoolProperties","com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolUpdateParameters":"Microsoft.ContainerRegistry.AgentPoolUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties":"Microsoft.ContainerRegistry.AgentProperties","com.azure.resourcemanager.containerregistry.tasks.models.Architecture":"Microsoft.ContainerRegistry.Architecture","com.azure.resourcemanager.containerregistry.tasks.models.Argument":"Microsoft.ContainerRegistry.Argument","com.azure.resourcemanager.containerregistry.tasks.models.AuthInfo":"Microsoft.ContainerRegistry.AuthInfo","com.azure.resourcemanager.containerregistry.tasks.models.AuthInfoUpdateParameters":"Microsoft.ContainerRegistry.AuthInfoUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.BaseImageDependency":"Microsoft.ContainerRegistry.BaseImageDependency","com.azure.resourcemanager.containerregistry.tasks.models.BaseImageDependencyType":"Microsoft.ContainerRegistry.BaseImageDependencyType","com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTrigger":"Microsoft.ContainerRegistry.BaseImageTrigger","com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerType":"Microsoft.ContainerRegistry.BaseImageTriggerType","com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerUpdateParameters":"Microsoft.ContainerRegistry.BaseImageTriggerUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.Credentials":"Microsoft.ContainerRegistry.Credentials","com.azure.resourcemanager.containerregistry.tasks.models.CustomRegistryCredentials":"Microsoft.ContainerRegistry.CustomRegistryCredentials","com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildRequest":"Microsoft.ContainerRegistry.DockerBuildRequest","com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStep":"Microsoft.ContainerRegistry.DockerBuildStep","com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStepUpdateParameters":"Microsoft.ContainerRegistry.DockerBuildStepUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest":"Microsoft.ContainerRegistry.EncodedTaskRunRequest","com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskStep":"Microsoft.ContainerRegistry.EncodedTaskStep","com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskStepUpdateParameters":"Microsoft.ContainerRegistry.EncodedTaskStepUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.FileTaskRunRequest":"Microsoft.ContainerRegistry.FileTaskRunRequest","com.azure.resourcemanager.containerregistry.tasks.models.FileTaskStep":"Microsoft.ContainerRegistry.FileTaskStep","com.azure.resourcemanager.containerregistry.tasks.models.FileTaskStepUpdateParameters":"Microsoft.ContainerRegistry.FileTaskStepUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties":"Microsoft.ContainerRegistry.IdentityProperties","com.azure.resourcemanager.containerregistry.tasks.models.ImageDescriptor":"Microsoft.ContainerRegistry.ImageDescriptor","com.azure.resourcemanager.containerregistry.tasks.models.ImageUpdateTrigger":"Microsoft.ContainerRegistry.ImageUpdateTrigger","com.azure.resourcemanager.containerregistry.tasks.models.OS":"Microsoft.ContainerRegistry.OS","com.azure.resourcemanager.containerregistry.tasks.models.OverrideTaskStepProperties":"Microsoft.ContainerRegistry.OverrideTaskStepProperties","com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties":"Microsoft.ContainerRegistry.PlatformProperties","com.azure.resourcemanager.containerregistry.tasks.models.PlatformUpdateParameters":"Microsoft.ContainerRegistry.PlatformUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.ProvisioningState":"Microsoft.ContainerRegistry.ProvisioningState","com.azure.resourcemanager.containerregistry.tasks.models.ResourceIdentityType":"Microsoft.ContainerRegistry.ResourceIdentityType","com.azure.resourcemanager.containerregistry.tasks.models.RunProperties":"Microsoft.ContainerRegistry.RunProperties","com.azure.resourcemanager.containerregistry.tasks.models.RunRequest":"Microsoft.ContainerRegistry.RunRequest","com.azure.resourcemanager.containerregistry.tasks.models.RunStatus":"Microsoft.ContainerRegistry.RunStatus","com.azure.resourcemanager.containerregistry.tasks.models.RunType":"Microsoft.ContainerRegistry.RunType","com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters":"Microsoft.ContainerRegistry.RunUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.SecretObject":"Microsoft.ContainerRegistry.SecretObject","com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType":"Microsoft.ContainerRegistry.SecretObjectType","com.azure.resourcemanager.containerregistry.tasks.models.SetValue":"Microsoft.ContainerRegistry.SetValue","com.azure.resourcemanager.containerregistry.tasks.models.SourceControlType":"Microsoft.ContainerRegistry.SourceControlType","com.azure.resourcemanager.containerregistry.tasks.models.SourceProperties":"Microsoft.ContainerRegistry.SourceProperties","com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials":"Microsoft.ContainerRegistry.SourceRegistryCredentials","com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryLoginMode":"Microsoft.ContainerRegistry.SourceRegistryLoginMode","com.azure.resourcemanager.containerregistry.tasks.models.SourceTrigger":"Microsoft.ContainerRegistry.SourceTrigger","com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerDescriptor":"Microsoft.ContainerRegistry.SourceTriggerDescriptor","com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerEvent":"Microsoft.ContainerRegistry.SourceTriggerEvent","com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerUpdateParameters":"Microsoft.ContainerRegistry.SourceTriggerUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.SourceUpdateParameters":"Microsoft.ContainerRegistry.SourceUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.StepType":"Microsoft.ContainerRegistry.StepType","com.azure.resourcemanager.containerregistry.tasks.models.TaskProperties":"Microsoft.ContainerRegistry.TaskProperties","com.azure.resourcemanager.containerregistry.tasks.models.TaskRunRequest":"Microsoft.ContainerRegistry.TaskRunRequest","com.azure.resourcemanager.containerregistry.tasks.models.TaskRunUpdateParameters":"Microsoft.ContainerRegistry.TaskRunUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus":"Microsoft.ContainerRegistry.TaskStatus","com.azure.resourcemanager.containerregistry.tasks.models.TaskStepProperties":"Microsoft.ContainerRegistry.TaskStepProperties","com.azure.resourcemanager.containerregistry.tasks.models.TaskStepUpdateParameters":"Microsoft.ContainerRegistry.TaskStepUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.TaskUpdateParameters":"Microsoft.ContainerRegistry.TaskUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.TimerTrigger":"Microsoft.ContainerRegistry.TimerTrigger","com.azure.resourcemanager.containerregistry.tasks.models.TimerTriggerDescriptor":"Microsoft.ContainerRegistry.TimerTriggerDescriptor","com.azure.resourcemanager.containerregistry.tasks.models.TimerTriggerUpdateParameters":"Microsoft.ContainerRegistry.TimerTriggerUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.TokenType":"Microsoft.ContainerRegistry.TokenType","com.azure.resourcemanager.containerregistry.tasks.models.TriggerProperties":"Microsoft.ContainerRegistry.TriggerProperties","com.azure.resourcemanager.containerregistry.tasks.models.TriggerStatus":"Microsoft.ContainerRegistry.TriggerStatus","com.azure.resourcemanager.containerregistry.tasks.models.TriggerUpdateParameters":"Microsoft.ContainerRegistry.TriggerUpdateParameters","com.azure.resourcemanager.containerregistry.tasks.models.UpdateTriggerPayloadType":"Microsoft.ContainerRegistry.UpdateTriggerPayloadType","com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties":"Microsoft.ContainerRegistry.UserIdentityProperties","com.azure.resourcemanager.containerregistry.tasks.models.Variant":"Microsoft.ContainerRegistry.Variant"},"generatedFiles":["src/main/java/com/azure/resourcemanager/containerregistry/tasks/ContainerRegistryTasksManager.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/AgentPoolsClient.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/ContainerRegistryTasksManagementClient.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RegistriesClient.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/RunsClient.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TaskRunsClient.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/TasksClient.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolPropertiesUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/AgentPoolQueueStatusInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunGetLogResultInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/RunInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/SourceUploadDefinitionInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskPropertiesUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesInner.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/TaskRunPropertiesUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/fluent/package-info.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolQueueStatusImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsClientImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/AgentPoolsImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ContainerRegistryTasksManagementClientImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesClientImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RegistriesImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunGetLogResultImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsClientImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/RunsImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/SourceUploadDefinitionImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunPropertiesImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsClientImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TaskRunsImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksClientImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/TasksImpl.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/AgentPoolListResult.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/RunListResult.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskListResult.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/models/TaskRunListResult.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/implementation/package-info.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPool.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolQueueStatus.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPoolUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentPools.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AgentProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Architecture.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Argument.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfo.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/AuthInfoUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependency.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageDependencyType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTrigger.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/BaseImageTriggerUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Credentials.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/CustomRegistryCredentials.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildRequest.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStep.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/DockerBuildStepUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskRunRequest.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStep.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/EncodedTaskStepUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskRunRequest.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStep.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/FileTaskStepUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/IdentityProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageDescriptor.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ImageUpdateTrigger.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OS.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/OverrideTaskStepProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/PlatformUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Registries.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/ResourceIdentityType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Run.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunGetLogResult.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunRequest.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunStatus.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/RunUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Runs.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObject.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SecretObjectType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SetValue.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceControlType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryCredentials.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceRegistryLoginMode.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTrigger.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerDescriptor.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerEvent.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceTriggerUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/SourceUploadDefinition.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/StepType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Task.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRun.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunRequest.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRunUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskRuns.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStatus.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskStepUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TaskUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Tasks.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTrigger.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerDescriptor.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TimerTriggerUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TokenType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerStatus.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/TriggerUpdateParameters.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UpdateTriggerPayloadType.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/UserIdentityProperties.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/Variant.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/models/package-info.java","src/main/java/com/azure/resourcemanager/containerregistry/tasks/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-containerregistry-tasks/proxy-config.json b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-containerregistry-tasks/proxy-config.json new file mode 100644 index 000000000000..a7843607fb5c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-containerregistry-tasks/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.containerregistry.tasks.implementation.AgentPoolsClientImpl$AgentPoolsService"],["com.azure.resourcemanager.containerregistry.tasks.implementation.RegistriesClientImpl$RegistriesService"],["com.azure.resourcemanager.containerregistry.tasks.implementation.RunsClientImpl$RunsService"],["com.azure.resourcemanager.containerregistry.tasks.implementation.TaskRunsClientImpl$TaskRunsService"],["com.azure.resourcemanager.containerregistry.tasks.implementation.TasksClientImpl$TasksService"]] \ No newline at end of file diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-containerregistry-tasks/reflect-config.json b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-containerregistry-tasks/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-containerregistry-tasks/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/azure-resourcemanager-containerregistry-tasks.properties b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/azure-resourcemanager-containerregistry-tasks.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/main/resources/azure-resourcemanager-containerregistry-tasks.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsCreateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsCreateSamples.java new file mode 100644 index 000000000000..325b989b7c52 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsCreateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AgentPools Create. + */ +public final class AgentPoolsCreateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsCreate.json + */ + /** + * Sample code: AgentPools_Create. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsCreate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools() + .define("myAgentPool") + .withRegion("WESTUS") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("key", "fakeTokenPlaceholder")) + .withProperties(new AgentPoolProperties().withCount(1).withTier("S1").withOs(OS.LINUX)) + .create(); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsDeleteSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsDeleteSamples.java new file mode 100644 index 000000000000..4e4d700eb4cc --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for AgentPools Delete. + */ +public final class AgentPoolsDeleteSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsDelete.json + */ + /** + * Sample code: AgentPools_Delete. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsDelete(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools().delete("myResourceGroup", "myRegistry", "myAgentPool", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetQueueStatusSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetQueueStatusSamples.java new file mode 100644 index 000000000000..20c961f08f19 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetQueueStatusSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for AgentPools GetQueueStatus. + */ +public final class AgentPoolsGetQueueStatusSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsGetQueueStatus.json + */ + /** + * Sample code: AgentPools_GetQueueStatus. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void agentPoolsGetQueueStatus( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools() + .getQueueStatusWithResponse("myResourceGroup", "myRegistry", "myAgentPool", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetSamples.java new file mode 100644 index 000000000000..1c907072cd81 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for AgentPools Get. + */ +public final class AgentPoolsGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsGet.json + */ + /** + * Sample code: AgentPools_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools() + .getWithResponse("myResourceGroup", "myRegistry", "myAgentPool", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsListSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsListSamples.java new file mode 100644 index 000000000000..6a12445d8b40 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for AgentPools List. + */ +public final class AgentPoolsListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsList.json + */ + /** + * Sample code: AgentPools_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.agentPools().list("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsUpdateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsUpdateSamples.java new file mode 100644 index 000000000000..79ec4bb89cef --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; + +/** + * Samples for AgentPools Update. + */ +public final class AgentPoolsUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/AgentPoolsUpdate.json + */ + /** + * Sample code: AgentPools_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + agentPoolsUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + AgentPool resource = manager.agentPools() + .getWithResponse("myResourceGroup", "myRegistry", "myAgentPool", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withCount(1).apply(); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesGetBuildSourceUploadUrlSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesGetBuildSourceUploadUrlSamples.java new file mode 100644 index 000000000000..3a723abb1842 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesGetBuildSourceUploadUrlSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Registries GetBuildSourceUploadUrl. + */ +public final class RegistriesGetBuildSourceUploadUrlSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesGetBuildSourceUploadUrl.json + */ + /** + * Sample code: Registries_GetBuildSourceUploadUrl. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesGetBuildSourceUploadUrl( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .getBuildSourceUploadUrlWithResponse("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesScheduleRunSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesScheduleRunSamples.java new file mode 100644 index 000000000000..47c713954491 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesScheduleRunSamples.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Argument; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.CustomRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.FileTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.OverrideTaskStepProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObject; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType; +import com.azure.resourcemanager.containerregistry.tasks.models.SetValue; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryLoginMode; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunRequest; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Registries ScheduleRun. + */ +public final class RegistriesScheduleRunSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_FileTaskRun.json + */ + /** + * Sample code: Registries_ScheduleRun_FileTaskRun. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunFileTaskRun( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new FileTaskRunRequest() + .withTaskFilePath("acb.yaml") + .withValuesFilePath("prod-values.yaml") + .withValues(Arrays.asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun.json + */ + /** + * Sample code: Registries_ScheduleRun. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + registriesScheduleRun(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_EncodedTaskRun.json + */ + /** + * Sample code: Registries_ScheduleRun_EncodedTaskRun. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunEncodedTaskRun( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new EncodedTaskRunRequest() + .withEncodedTaskContent("fakeTokenPlaceholder") + .withEncodedValuesContent("fakeTokenPlaceholder") + .withValues(Arrays.asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withAgentConfiguration(new AgentProperties().withCpu(2)), com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_WithCustomCredentials.json + */ + /** + * Sample code: Registries_ScheduleRun_WithCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunWithCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withTarget("stage1") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D") + .withCredentials(new Credentials() + .withSourceRegistry(new SourceRegistryCredentials().withLoginMode(SourceRegistryLoginMode.DEFAULT)) + .withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("reg1").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE)), + "myregistry2.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("reg2").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_WithLogTemplate.json + */ + /** + * Sample code: Registries_ScheduleRun_WithLogTemplate. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunWithLogTemplate( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new DockerBuildRequest() + .withIsArchiveEnabled(true) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(true) + .withDockerFilePath("DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withSourceLocation( + "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_Task.json + */ + /** + * Sample code: Registries_ScheduleRun_Task. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunTask( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", + new TaskRunRequest().withTaskId("myTask") + .withOverrideTaskStepProperties(new OverrideTaskStepProperties().withFile("overriddenDockerfile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withTarget("build") + .withValues(Arrays.asList( + new SetValue().withName("mytestname").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestname") + .withValue("mysecrettestvalue") + .withIsSecret(true))) + .withUpdateTriggerToken("fakeTokenPlaceholder")), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2025-03-01-preview/RegistriesScheduleRun_FileTask_WithCustomCredentials.json + */ + /** + * Sample code: Registries_ScheduleRun_Task_WithCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void registriesScheduleRunTaskWithCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.registries() + .scheduleRunWithResponse("myResourceGroup", "myRegistry", new FileTaskRunRequest() + .withTaskFilePath("acb.yaml") + .withValues(Arrays.asList( + new SetValue().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new SetValue().withName("mysecrettestargument").withValue("mysecrettestvalue").withIsSecret(true))) + .withPlatform(new PlatformProperties().withOs(OS.LINUX)) + .withCredentials(new Credentials() + .withSourceRegistry(new SourceRegistryCredentials().withLoginMode(SourceRegistryLoginMode.DEFAULT)) + .withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("reg1").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))), + com.azure.core.util.Context.NONE); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsCancelSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsCancelSamples.java new file mode 100644 index 000000000000..2c571c416dc9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsCancelSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Runs Cancel. + */ +public final class RunsCancelSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsCancel.json + */ + /** + * Sample code: Runs_Cancel. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsCancel(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .cancelWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetLogSasUrlSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetLogSasUrlSamples.java new file mode 100644 index 000000000000..69ec3f923fe3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetLogSasUrlSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Runs GetLogSasUrl. + */ +public final class RunsGetLogSasUrlSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsGetLogSasUrl.json + */ + /** + * Sample code: Runs_GetLogSasUrl. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsGetLogSasUrl(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .getLogSasUrlWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetSamples.java new file mode 100644 index 000000000000..7fe73c0c7553 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Runs Get. + */ +public final class RunsGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsGet.json + */ + /** + * Sample code: Runs_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .getWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsListSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsListSamples.java new file mode 100644 index 000000000000..28844a48285f --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Runs List. + */ +public final class RunsListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsList.json + */ + /** + * Sample code: Runs_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs().list("myResourceGroup", "myRegistry", "", 10, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsUpdateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsUpdateSamples.java new file mode 100644 index 000000000000..49701b7e2469 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsUpdateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters; + +/** + * Samples for Runs Update. + */ +public final class RunsUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/RunsUpdate.json + */ + /** + * Sample code: Runs_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + runsUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.runs() + .updateWithResponse("myResourceGroup", "myRegistry", "0accec26-d6de-4757-8e74-d080f38eaaab", + new RunUpdateParameters().withIsArchiveEnabled(true), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsCreateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsCreateSamples.java new file mode 100644 index 000000000000..2bc86fb30075 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsCreateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesInner; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import java.util.Arrays; + +/** + * Samples for TaskRuns Create. + */ +public final class TaskRunsCreateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsCreate.json + */ + /** + * Sample code: TaskRuns_Create. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsCreate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns() + .define("myRun") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withProperties(new TaskRunPropertiesInner() + .withRunRequest(new EncodedTaskRunRequest().withEncodedTaskContent("fakeTokenPlaceholder") + .withEncodedValuesContent("fakeTokenPlaceholder") + .withValues(Arrays.asList()) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withCredentials(new Credentials())) + .withForceUpdateTag("test")) + .create(); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsDeleteSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsDeleteSamples.java new file mode 100644 index 000000000000..38db58ef1ea9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for TaskRuns Delete. + */ +public final class TaskRunsDeleteSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsDelete.json + */ + /** + * Sample code: TaskRuns_Delete. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsDelete(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns() + .deleteWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsGetDetailsSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsGetDetailsSamples.java new file mode 100644 index 000000000000..bba7c77acee4 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsGetDetailsSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for TaskRuns GetDetails. + */ +public final class TaskRunsGetDetailsSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsGetDetails.json + */ + /** + * Sample code: TaskRuns_GetDetails. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsGetDetails(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns() + .getDetailsWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsGetSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsGetSamples.java new file mode 100644 index 000000000000..5c117e03ed8a --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for TaskRuns Get. + */ +public final class TaskRunsGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsGet.json + */ + /** + * Sample code: TaskRuns_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns().getWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsListSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsListSamples.java new file mode 100644 index 000000000000..a6bd7286e187 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for TaskRuns List. + */ +public final class TaskRunsListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsList.json + */ + /** + * Sample code: TaskRuns_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.taskRuns().list("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsUpdateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsUpdateSamples.java new file mode 100644 index 000000000000..88bb8ad15641 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.EncodedTaskRunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRun; +import java.util.Arrays; + +/** + * Samples for TaskRuns Update. + */ +public final class TaskRunsUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TaskRunsUpdate.json + */ + /** + * Sample code: TaskRuns_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + taskRunsUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + TaskRun resource = manager.taskRuns() + .getWithResponse("myResourceGroup", "myRegistry", "myRun", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withRunRequest(new EncodedTaskRunRequest().withIsArchiveEnabled(true) + .withEncodedTaskContent("fakeTokenPlaceholder") + .withEncodedValuesContent("fakeTokenPlaceholder") + .withValues(Arrays.asList()) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withCredentials(new Credentials())) + .withForceUpdateTag("test") + .apply(); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksCreateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksCreateSamples.java new file mode 100644 index 000000000000..ee8ef3350ab3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksCreateSamples.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.Argument; +import com.azure.resourcemanager.containerregistry.tasks.models.AuthInfo; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerType; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStep; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.ResourceIdentityType; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceControlType; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerEvent; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.TimerTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.TokenType; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.UpdateTriggerPayloadType; +import com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tasks Create. + */ +public final class TasksCreateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithSystemIdentity.json + */ + /** + * Sample code: Tasks_Create_WithUserIdentities_WithSystemIdentity. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithUserIdentitiesWithSystemIdentity( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithLoginIdentity.json + */ + /** + * Sample code: Tasks_Create_WithLoginIdentity. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithLoginIdentity( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withName("myBaseImageTrigger"))) + .withCredentials( + new Credentials().withSourceRegistry(new SourceRegistryCredentials().withIdentity("[system]"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksCreate.json + */ + /** + * Sample code: Tasks_Create. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksCreate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.TOKEN) + .withName("myBaseImageTrigger"))) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED)) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithSystemAndUserIdentities.json + */ + /** + * Sample code: Tasks_Create_WithSystemAndUserIdentities. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithSystemAndUserIdentities( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksCreate_WithUserIdentities.json + */ + /** + * Sample code: Tasks_Create_WithUserIdentities. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksCreateWithUserIdentities( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("mytTask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withPlatform(new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.AMD64)) + .withAgentConfiguration(new AgentProperties().withCpu(2)) + .withStep(new DockerBuildStep().withContextPath("src") + .withImageNames(Arrays.asList("azurerest:testtag")) + .withIsPushEnabled(true) + .withNoCache(false) + .withDockerFilePath("src/DockerFile") + .withArguments(Arrays.asList( + new Argument().withName("mytestargument").withValue("mytestvalue").withIsSecret(false), + new Argument().withName("mysecrettestargument") + .withValue("mysecrettestvalue") + .withIsSecret(true)))) + .withTrigger( + new TriggerProperties() + .withTimerTriggers( + Arrays.asList(new TimerTrigger().withSchedule("30 9 * * 1-5").withName("myTimerTrigger"))) + .withSourceTriggers( + Arrays.asList(new SourceTrigger() + .withSourceRepository( + new SourceProperties().withSourceControlType(SourceControlType.GITHUB) + .withRepositoryUrl("https://github.com/Azure/azure-rest-api-specs") + .withBranch("master") + .withSourceControlAuthProperties(new AuthInfo().withTokenType(TokenType.PAT) + .withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger"))) + .withBaseImageTrigger( + new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.RUNTIME) + .withUpdateTriggerEndpoint("https://user:pass@mycicd.webhook.com?token=foo") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withName("myBaseImageTrigger"))) + .withIsSystemTask(false)) + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf( + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1", + new UserIdentityProperties(), + "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2", + new UserIdentityProperties()))) + .create(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksCreate_QuickTask.json + */ + /** + * Sample code: Tasks_Create_QuickTask. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksCreateQuickTask(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .define("quicktask") + .withRegion("eastus") + .withExistingRegistry("myResourceGroup", "myRegistry") + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withProperties(new TaskProperties().withStatus(TaskStatus.ENABLED) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .withIsSystemTask(true)) + .create(); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksDeleteSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksDeleteSamples.java new file mode 100644 index 000000000000..11af8e8eed8c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Tasks Delete. + */ +public final class TasksDeleteSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksDelete.json + */ + /** + * Sample code: Tasks_Delete. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksDelete(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks().deleteWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksGetDetailsSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksGetDetailsSamples.java new file mode 100644 index 000000000000..e93e10eb8d9b --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksGetDetailsSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Tasks GetDetails. + */ +public final class TasksGetDetailsSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksGetDetails.json + */ + /** + * Sample code: Tasks_GetDetails. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksGetDetails(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks() + .getDetailsWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksGetSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksGetSamples.java new file mode 100644 index 000000000000..84a45e54cd62 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Tasks Get. + */ +public final class TasksGetSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksGet.json + */ + /** + * Sample code: Tasks_Get. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksGet(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks().getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksListSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksListSamples.java new file mode 100644 index 000000000000..b9943b02ec84 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +/** + * Samples for Tasks List. + */ +public final class TasksListSamples { + /* + * x-ms-original-file: 2025-03-01-preview/TasksList.json + */ + /** + * Sample code: Tasks_List. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksList(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + manager.tasks().list("myResourceGroup", "myRegistry", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksUpdateSamples.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksUpdateSamples.java new file mode 100644 index 000000000000..53b271ce1121 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/samples/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksUpdateSamples.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.AuthInfoUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Credentials; +import com.azure.resourcemanager.containerregistry.tasks.models.CustomRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.DockerBuildStepUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObject; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerEvent; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Task; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.TokenType; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerUpdateParameters; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tasks Update. + */ +public final class TasksUpdateSamples { + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksUpdate_WithLoginIdentity.json + */ + /** + * Sample code: Tasks_Update_WithLoginIdentity. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithLoginIdentity( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials( + new Credentials().withSourceRegistry(new SourceRegistryCredentials().withIdentity("[system]"))) + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksUpdate_QuickTask.json + */ + /** + * Sample code: Tasks_Update_QuickTask. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksUpdateQuickTask(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "quicktask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithMSICustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithMSICustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries( + mapOf("myregistry.azurecr.io", new CustomRegistryCredentials().withIdentity("[system]")))) + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/ManagedIdentity/TasksUpdate_WithKeyVaultCustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithKeyVaultCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithKeyVaultCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("https://myacbvault.vault.azure.net/secrets/username") + .withType(SecretObjectType.VAULTSECRET)) + .withPassword(new SecretObject().withValue("https://myacbvault.vault.azure.net/secrets/password") + .withType(SecretObjectType.VAULTSECRET)) + .withIdentity("[system]")))) + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksUpdate.json + */ + /** + * Sample code: Tasks_Update. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void + tasksUpdate(com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("username").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("https://myacbvault.vault.azure.net/secrets/password") + .withType(SecretObjectType.VAULTSECRET)) + .withIdentity("[system]")))) + .withLogTemplate("acr/tasks:{{.Run.OS}}") + .apply(); + } + + /* + * x-ms-original-file: 2025-03-01-preview/TasksUpdate_WithOpaqueCustomCredentials.json + */ + /** + * Sample code: Tasks_Update_WithOpaqueCustomCredentials. + * + * @param manager Entry point to ContainerRegistryTasksManager. + */ + public static void tasksUpdateWithOpaqueCustomCredentials( + com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager manager) { + Task resource = manager.tasks() + .getWithResponse("myResourceGroup", "myRegistry", "myTask", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("testkey", "fakeTokenPlaceholder")) + .withStatus(TaskStatus.ENABLED) + .withAgentConfiguration(new AgentProperties().withCpu(3)) + .withStep(new DockerBuildStepUpdateParameters().withImageNames(Arrays.asList("azurerest:testtag1")) + .withDockerFilePath("src/DockerFile")) + .withTrigger( + new TriggerUpdateParameters().withSourceTriggers(Arrays.asList(new SourceTriggerUpdateParameters() + .withSourceRepository(new SourceUpdateParameters().withSourceControlAuthProperties( + new AuthInfoUpdateParameters().withTokenType(TokenType.PAT).withToken("fakeTokenPlaceholder"))) + .withSourceTriggerEvents(Arrays.asList(SourceTriggerEvent.COMMIT)) + .withName("mySourceTrigger")))) + .withCredentials(new Credentials().withCustomRegistries(mapOf("myregistry.azurecr.io", + new CustomRegistryCredentials() + .withUserName(new SecretObject().withValue("username").withType(SecretObjectType.OPAQUE)) + .withPassword(new SecretObject().withValue("***").withType(SecretObjectType.OPAQUE))))) + .apply(); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolInnerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolInnerTests.java new file mode 100644 index 000000000000..5e90caaf6793 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolInnerTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolInner; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AgentPoolInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentPoolInner model = BinaryData.fromString( + "{\"properties\":{\"count\":304908421,\"tier\":\"uv\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"ybczmehmtzo\",\"provisioningState\":\"Canceled\"},\"location\":\"h\",\"tags\":{\"hphoycm\":\"idgsybbe\",\"htbmuf\":\"xaobhdxbmtqioqjz\",\"rxybqsoq\":\"ownoizhw\",\"pdznrbtcqqjnqgl\":\"jgkdmbpazlobcu\"},\"id\":\"qgn\",\"name\":\"foooj\",\"type\":\"wifsq\"}") + .toObject(AgentPoolInner.class); + Assertions.assertEquals("h", model.location()); + Assertions.assertEquals("idgsybbe", model.tags().get("hphoycm")); + Assertions.assertEquals(304908421, model.properties().count()); + Assertions.assertEquals("uv", model.properties().tier()); + Assertions.assertEquals(OS.WINDOWS, model.properties().os()); + Assertions.assertEquals("ybczmehmtzo", model.properties().virtualNetworkSubnetResourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentPoolInner model = new AgentPoolInner().withLocation("h") + .withTags(mapOf("hphoycm", "idgsybbe", "htbmuf", "xaobhdxbmtqioqjz", "rxybqsoq", "ownoizhw", + "pdznrbtcqqjnqgl", "jgkdmbpazlobcu")) + .withProperties(new AgentPoolProperties().withCount(304908421) + .withTier("uv") + .withOs(OS.WINDOWS) + .withVirtualNetworkSubnetResourceId("ybczmehmtzo")); + model = BinaryData.fromObject(model).toObject(AgentPoolInner.class); + Assertions.assertEquals("h", model.location()); + Assertions.assertEquals("idgsybbe", model.tags().get("hphoycm")); + Assertions.assertEquals(304908421, model.properties().count()); + Assertions.assertEquals("uv", model.properties().tier()); + Assertions.assertEquals(OS.WINDOWS, model.properties().os()); + Assertions.assertEquals("ybczmehmtzo", model.properties().virtualNetworkSubnetResourceId()); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolListResultTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolListResultTests.java new file mode 100644 index 000000000000..9dfdffa09c18 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolListResultTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.implementation.models.AgentPoolListResult; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import org.junit.jupiter.api.Assertions; + +public final class AgentPoolListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentPoolListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"count\":337855308,\"tier\":\"he\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"jtxukcdm\",\"provisioningState\":\"Creating\"},\"location\":\"ryuanzwuxzdxtay\",\"tags\":{\"hfpmrqobmtukknr\":\"m\",\"gnwzsymglzufc\":\"rtihfxtijbpz\",\"hdbihan\":\"zk\"},\"id\":\"fhfcb\",\"name\":\"y\",\"type\":\"a\"},{\"properties\":{\"count\":901713267,\"tier\":\"qhabifpikxwcz\",\"os\":\"Linux\",\"virtualNetworkSubnetResourceId\":\"npqxuh\",\"provisioningState\":\"Succeeded\"},\"location\":\"n\",\"tags\":{\"vd\":\"ybrk\"},\"id\":\"mjgr\",\"name\":\"fwvuk\",\"type\":\"gaudcc\"},{\"properties\":{\"count\":14804050,\"tier\":\"cnyejhkryhtnapcz\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"jye\",\"provisioningState\":\"Failed\"},\"location\":\"ni\",\"tags\":{\"odmailzyd\":\"xzjnchgejs\",\"jwyahuxinpmqnja\":\"h\",\"tegjvwmf\":\"wixjsprozvcp\",\"pjhulsuuvmkj\":\"atscmd\"},\"id\":\"zkrwfn\",\"name\":\"iodjp\",\"type\":\"lwejdpv\"},{\"properties\":{\"count\":1450432721,\"tier\":\"psoacctazakljl\",\"os\":\"Linux\",\"virtualNetworkSubnetResourceId\":\"ryffdfdosy\",\"provisioningState\":\"Failed\"},\"location\":\"aojakhmsbzjhcrz\",\"tags\":{\"lthqtrgqjbp\":\"phlxa\",\"jrwzox\":\"zfsinzgvf\",\"felluwfzitonpe\":\"j\"},\"id\":\"fpjkjlxofp\",\"name\":\"vhpfxxypininmay\",\"type\":\"uybbkpodep\"}],\"nextLink\":\"ginuvamih\"}") + .toObject(AgentPoolListResult.class); + Assertions.assertEquals("ryuanzwuxzdxtay", model.value().get(0).location()); + Assertions.assertEquals("m", model.value().get(0).tags().get("hfpmrqobmtukknr")); + Assertions.assertEquals(337855308, model.value().get(0).properties().count()); + Assertions.assertEquals("he", model.value().get(0).properties().tier()); + Assertions.assertEquals(OS.WINDOWS, model.value().get(0).properties().os()); + Assertions.assertEquals("jtxukcdm", model.value().get(0).properties().virtualNetworkSubnetResourceId()); + Assertions.assertEquals("ginuvamih", model.nextLink()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolPropertiesTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolPropertiesTests.java new file mode 100644 index 000000000000..24176bb10c3d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolPropertiesTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import org.junit.jupiter.api.Assertions; + +public final class AgentPoolPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentPoolProperties model = BinaryData.fromString( + "{\"count\":1701108276,\"tier\":\"gdf\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"lhjxr\",\"provisioningState\":\"Succeeded\"}") + .toObject(AgentPoolProperties.class); + Assertions.assertEquals(1701108276, model.count()); + Assertions.assertEquals("gdf", model.tier()); + Assertions.assertEquals(OS.WINDOWS, model.os()); + Assertions.assertEquals("lhjxr", model.virtualNetworkSubnetResourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentPoolProperties model = new AgentPoolProperties().withCount(1701108276) + .withTier("gdf") + .withOs(OS.WINDOWS) + .withVirtualNetworkSubnetResourceId("lhjxr"); + model = BinaryData.fromObject(model).toObject(AgentPoolProperties.class); + Assertions.assertEquals(1701108276, model.count()); + Assertions.assertEquals("gdf", model.tier()); + Assertions.assertEquals(OS.WINDOWS, model.os()); + Assertions.assertEquals("lhjxr", model.virtualNetworkSubnetResourceId()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolPropertiesUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolPropertiesUpdateParametersTests.java new file mode 100644 index 000000000000..abf4b324bb67 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolPropertiesUpdateParametersTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolPropertiesUpdateParameters; +import org.junit.jupiter.api.Assertions; + +public final class AgentPoolPropertiesUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentPoolPropertiesUpdateParameters model + = BinaryData.fromString("{\"count\":2032289729}").toObject(AgentPoolPropertiesUpdateParameters.class); + Assertions.assertEquals(2032289729, model.count()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentPoolPropertiesUpdateParameters model = new AgentPoolPropertiesUpdateParameters().withCount(2032289729); + model = BinaryData.fromObject(model).toObject(AgentPoolPropertiesUpdateParameters.class); + Assertions.assertEquals(2032289729, model.count()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolQueueStatusInnerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolQueueStatusInnerTests.java new file mode 100644 index 000000000000..905317aaba36 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolQueueStatusInnerTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.AgentPoolQueueStatusInner; +import org.junit.jupiter.api.Assertions; + +public final class AgentPoolQueueStatusInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentPoolQueueStatusInner model + = BinaryData.fromString("{\"count\":774982264}").toObject(AgentPoolQueueStatusInner.class); + Assertions.assertEquals(774982264, model.count()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolUpdateParametersTests.java new file mode 100644 index 000000000000..2c8b671f259a --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolUpdateParametersTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolUpdateParameters; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AgentPoolUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentPoolUpdateParameters model = BinaryData.fromString( + "{\"properties\":{\"count\":1495226068},\"tags\":{\"psqucmpoyf\":\"tsizntocipaoua\",\"knygjofjddeq\":\"kfo\",\"upewnwreitjzy\":\"rd\",\"ofcqhsm\":\"lusarh\"}}") + .toObject(AgentPoolUpdateParameters.class); + Assertions.assertEquals("tsizntocipaoua", model.tags().get("psqucmpoyf")); + Assertions.assertEquals(1495226068, model.count()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentPoolUpdateParameters model = new AgentPoolUpdateParameters() + .withTags(mapOf("psqucmpoyf", "tsizntocipaoua", "knygjofjddeq", "kfo", "upewnwreitjzy", "rd", "ofcqhsm", + "lusarh")) + .withCount(1495226068); + model = BinaryData.fromObject(model).toObject(AgentPoolUpdateParameters.class); + Assertions.assertEquals("tsizntocipaoua", model.tags().get("psqucmpoyf")); + Assertions.assertEquals(1495226068, model.count()); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsCreateMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsCreateMockTests.java new file mode 100644 index 000000000000..e2bd8103dc24 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsCreateMockTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AgentPoolsCreateMockTests { + @Test + public void testCreate() throws Exception { + String responseStr + = "{\"properties\":{\"count\":1547081847,\"tier\":\"abikns\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"hxbld\",\"provisioningState\":\"Succeeded\"},\"location\":\"rlkdmtncvokotl\",\"tags\":{\"cogjltdtbn\":\"yhgsy\"},\"id\":\"hadoocrk\",\"name\":\"cikhnv\",\"type\":\"amqgxqquezikyw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AgentPool response = manager.agentPools() + .define("hqkvpuvksgplsak") + .withRegion("qiy") + .withExistingRegistry("iipfpubj", "bwwift") + .withTags(mapOf("hleosjsw", "rz", "qioxi", "rmslyzrpzbchckqq")) + .withProperties(new AgentPoolProperties().withCount(792282663) + .withTier("ynl") + .withOs(OS.LINUX) + .withVirtualNetworkSubnetResourceId("op")) + .create(); + + Assertions.assertEquals("rlkdmtncvokotl", response.location()); + Assertions.assertEquals("yhgsy", response.tags().get("cogjltdtbn")); + Assertions.assertEquals(1547081847, response.properties().count()); + Assertions.assertEquals("abikns", response.properties().tier()); + Assertions.assertEquals(OS.WINDOWS, response.properties().os()); + Assertions.assertEquals("hxbld", response.properties().virtualNetworkSubnetResourceId()); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetQueueStatusWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetQueueStatusWithResponseMockTests.java new file mode 100644 index 000000000000..b80c1c24acec --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetQueueStatusWithResponseMockTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPoolQueueStatus; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AgentPoolsGetQueueStatusWithResponseMockTests { + @Test + public void testGetQueueStatusWithResponse() throws Exception { + String responseStr = "{\"count\":1905366329}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AgentPoolQueueStatus response = manager.agentPools() + .getQueueStatusWithResponse("aeneqnzarrwl", "uu", "jfqka", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(1905366329, response.count()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetWithResponseMockTests.java new file mode 100644 index 000000000000..752cbe44bb45 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsGetWithResponseMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AgentPoolsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"count\":2143349080,\"tier\":\"pvhelxprg\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"dd\",\"provisioningState\":\"Creating\"},\"location\":\"cuejrjxgci\",\"tags\":{\"sdqrhzoymibmrq\":\"rhos\"},\"id\":\"ibahwflus\",\"name\":\"dtmhrkwofyyvoqa\",\"type\":\"piexpbtgiw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AgentPool response = manager.agentPools() + .getWithResponse("v", "ajqgxy", "mocmbqfqvmk", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("cuejrjxgci", response.location()); + Assertions.assertEquals("rhos", response.tags().get("sdqrhzoymibmrq")); + Assertions.assertEquals(2143349080, response.properties().count()); + Assertions.assertEquals("pvhelxprg", response.properties().tier()); + Assertions.assertEquals(OS.WINDOWS, response.properties().os()); + Assertions.assertEquals("dd", response.properties().virtualNetworkSubnetResourceId()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsListMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsListMockTests.java new file mode 100644 index 000000000000..aa2109d68155 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPoolsListMockTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentPool; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class AgentPoolsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"count\":1525827841,\"tier\":\"xwbpokulpiuj\",\"os\":\"Windows\",\"virtualNetworkSubnetResourceId\":\"ipqiiobyuqerpq\",\"provisioningState\":\"Succeeded\"},\"location\":\"cciuqgbdbutau\",\"tags\":{\"afnn\":\"tkuwhhmhykojo\",\"ymkcdyhb\":\"lpichk\"},\"id\":\"kkpwdreqnovvq\",\"name\":\"ovljxywsu\",\"type\":\"syrsndsytgadgvra\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.agentPools().list("wo", "nwashrtd", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("cciuqgbdbutau", response.iterator().next().location()); + Assertions.assertEquals("tkuwhhmhykojo", response.iterator().next().tags().get("afnn")); + Assertions.assertEquals(1525827841, response.iterator().next().properties().count()); + Assertions.assertEquals("xwbpokulpiuj", response.iterator().next().properties().tier()); + Assertions.assertEquals(OS.WINDOWS, response.iterator().next().properties().os()); + Assertions.assertEquals("ipqiiobyuqerpq", + response.iterator().next().properties().virtualNetworkSubnetResourceId()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPropertiesTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPropertiesTests.java new file mode 100644 index 000000000000..6ac293d93ecb --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/AgentPropertiesTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.AgentProperties; +import org.junit.jupiter.api.Assertions; + +public final class AgentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AgentProperties model = BinaryData.fromString("{\"cpu\":2138839355}").toObject(AgentProperties.class); + Assertions.assertEquals(2138839355, model.cpu()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AgentProperties model = new AgentProperties().withCpu(2138839355); + model = BinaryData.fromObject(model).toObject(AgentProperties.class); + Assertions.assertEquals(2138839355, model.cpu()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageDependencyTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageDependencyTests.java new file mode 100644 index 000000000000..1e4c56b145b8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageDependencyTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageDependency; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageDependencyType; +import org.junit.jupiter.api.Assertions; + +public final class BaseImageDependencyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BaseImageDependency model = BinaryData.fromString( + "{\"type\":\"BuildTime\",\"registry\":\"qaqtdoqmcbxvwvxy\",\"repository\":\"qbhsfxobl\",\"tag\":\"k\",\"digest\":\"mpew\"}") + .toObject(BaseImageDependency.class); + Assertions.assertEquals(BaseImageDependencyType.BUILD_TIME, model.type()); + Assertions.assertEquals("qaqtdoqmcbxvwvxy", model.registry()); + Assertions.assertEquals("qbhsfxobl", model.repository()); + Assertions.assertEquals("k", model.tag()); + Assertions.assertEquals("mpew", model.digest()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageTriggerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageTriggerTests.java new file mode 100644 index 000000000000..73edb85b242c --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageTriggerTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerType; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.UpdateTriggerPayloadType; +import org.junit.jupiter.api.Assertions; + +public final class BaseImageTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BaseImageTrigger model = BinaryData.fromString( + "{\"baseImageTriggerType\":\"All\",\"updateTriggerEndpoint\":\"avhqlkth\",\"updateTriggerPayloadType\":\"Token\",\"status\":\"Enabled\",\"name\":\"lbg\"}") + .toObject(BaseImageTrigger.class); + Assertions.assertEquals(BaseImageTriggerType.ALL, model.baseImageTriggerType()); + Assertions.assertEquals("avhqlkth", model.updateTriggerEndpoint()); + Assertions.assertEquals(UpdateTriggerPayloadType.TOKEN, model.updateTriggerPayloadType()); + Assertions.assertEquals(TriggerStatus.ENABLED, model.status()); + Assertions.assertEquals("lbg", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BaseImageTrigger model = new BaseImageTrigger().withBaseImageTriggerType(BaseImageTriggerType.ALL) + .withUpdateTriggerEndpoint("avhqlkth") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.TOKEN) + .withStatus(TriggerStatus.ENABLED) + .withName("lbg"); + model = BinaryData.fromObject(model).toObject(BaseImageTrigger.class); + Assertions.assertEquals(BaseImageTriggerType.ALL, model.baseImageTriggerType()); + Assertions.assertEquals("avhqlkth", model.updateTriggerEndpoint()); + Assertions.assertEquals(UpdateTriggerPayloadType.TOKEN, model.updateTriggerPayloadType()); + Assertions.assertEquals(TriggerStatus.ENABLED, model.status()); + Assertions.assertEquals("lbg", model.name()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageTriggerUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageTriggerUpdateParametersTests.java new file mode 100644 index 000000000000..9aaffd6b27f9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/BaseImageTriggerUpdateParametersTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerType; +import com.azure.resourcemanager.containerregistry.tasks.models.BaseImageTriggerUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerStatus; +import com.azure.resourcemanager.containerregistry.tasks.models.UpdateTriggerPayloadType; +import org.junit.jupiter.api.Assertions; + +public final class BaseImageTriggerUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BaseImageTriggerUpdateParameters model = BinaryData.fromString( + "{\"baseImageTriggerType\":\"All\",\"updateTriggerEndpoint\":\"oegrpkhjwn\",\"updateTriggerPayloadType\":\"Default\",\"status\":\"Enabled\",\"name\":\"uicpd\"}") + .toObject(BaseImageTriggerUpdateParameters.class); + Assertions.assertEquals(BaseImageTriggerType.ALL, model.baseImageTriggerType()); + Assertions.assertEquals("oegrpkhjwn", model.updateTriggerEndpoint()); + Assertions.assertEquals(UpdateTriggerPayloadType.DEFAULT, model.updateTriggerPayloadType()); + Assertions.assertEquals(TriggerStatus.ENABLED, model.status()); + Assertions.assertEquals("uicpd", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BaseImageTriggerUpdateParameters model + = new BaseImageTriggerUpdateParameters().withBaseImageTriggerType(BaseImageTriggerType.ALL) + .withUpdateTriggerEndpoint("oegrpkhjwn") + .withUpdateTriggerPayloadType(UpdateTriggerPayloadType.DEFAULT) + .withStatus(TriggerStatus.ENABLED) + .withName("uicpd"); + model = BinaryData.fromObject(model).toObject(BaseImageTriggerUpdateParameters.class); + Assertions.assertEquals(BaseImageTriggerType.ALL, model.baseImageTriggerType()); + Assertions.assertEquals("oegrpkhjwn", model.updateTriggerEndpoint()); + Assertions.assertEquals(UpdateTriggerPayloadType.DEFAULT, model.updateTriggerPayloadType()); + Assertions.assertEquals(TriggerStatus.ENABLED, model.status()); + Assertions.assertEquals("uicpd", model.name()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/IdentityPropertiesTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/IdentityPropertiesTests.java new file mode 100644 index 000000000000..7311ba397ad6 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/IdentityPropertiesTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.ResourceIdentityType; +import com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class IdentityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IdentityProperties model = BinaryData.fromString( + "{\"principalId\":\"niwdjsw\",\"tenantId\":\"s\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"lcuhxwtctyqiklb\":{\"principalId\":\"ytxhp\",\"clientId\":\"bzpfzab\"},\"uosvmkfssxqukk\":{\"principalId\":\"vplwzbhv\",\"clientId\":\"u\"}}}") + .toObject(IdentityProperties.class); + Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IdentityProperties model = new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("lcuhxwtctyqiklb", new UserIdentityProperties(), "uosvmkfssxqukk", new UserIdentityProperties())); + model = BinaryData.fromObject(model).toObject(IdentityProperties.class); + Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/ImageDescriptorTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/ImageDescriptorTests.java new file mode 100644 index 000000000000..d61fd2372c12 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/ImageDescriptorTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.ImageDescriptor; +import org.junit.jupiter.api.Assertions; + +public final class ImageDescriptorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImageDescriptor model = BinaryData.fromString( + "{\"registry\":\"sycbkbfk\",\"repository\":\"kdkexxp\",\"tag\":\"fmxa\",\"digest\":\"fjpgddtocjjxhvp\"}") + .toObject(ImageDescriptor.class); + Assertions.assertEquals("sycbkbfk", model.registry()); + Assertions.assertEquals("kdkexxp", model.repository()); + Assertions.assertEquals("fmxa", model.tag()); + Assertions.assertEquals("fjpgddtocjjxhvp", model.digest()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/ImageUpdateTriggerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/ImageUpdateTriggerTests.java new file mode 100644 index 000000000000..e6b54cd5e4e8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/ImageUpdateTriggerTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.ImageUpdateTrigger; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ImageUpdateTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ImageUpdateTrigger model = BinaryData.fromString( + "{\"id\":\"uexhdzx\",\"timestamp\":\"2021-01-04T16:13:33Z\",\"images\":[{\"registry\":\"nxqbzvddn\",\"repository\":\"ndei\",\"tag\":\"twnpzaoqvuhrhcf\",\"digest\":\"yd\"},{\"registry\":\"lmjthjq\",\"repository\":\"pyeicxm\",\"tag\":\"iwqvhkh\",\"digest\":\"uigdtopbobjog\"},{\"registry\":\"e\",\"repository\":\"a\",\"tag\":\"uhrzayvvt\",\"digest\":\"vdfgiotk\"}]}") + .toObject(ImageUpdateTrigger.class); + Assertions.assertEquals("uexhdzx", model.id()); + Assertions.assertEquals(OffsetDateTime.parse("2021-01-04T16:13:33Z"), model.timestamp()); + Assertions.assertEquals("nxqbzvddn", model.images().get(0).registry()); + Assertions.assertEquals("ndei", model.images().get(0).repository()); + Assertions.assertEquals("twnpzaoqvuhrhcf", model.images().get(0).tag()); + Assertions.assertEquals("yd", model.images().get(0).digest()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/PlatformPropertiesTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/PlatformPropertiesTests.java new file mode 100644 index 000000000000..e8ac90d6fa8d --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/PlatformPropertiesTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.Variant; +import org.junit.jupiter.api.Assertions; + +public final class PlatformPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlatformProperties model + = BinaryData.fromString("{\"os\":\"Linux\",\"architecture\":\"arm\",\"variant\":\"v7\"}") + .toObject(PlatformProperties.class); + Assertions.assertEquals(OS.LINUX, model.os()); + Assertions.assertEquals(Architecture.ARM, model.architecture()); + Assertions.assertEquals(Variant.V7, model.variant()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlatformProperties model + = new PlatformProperties().withOs(OS.LINUX).withArchitecture(Architecture.ARM).withVariant(Variant.V7); + model = BinaryData.fromObject(model).toObject(PlatformProperties.class); + Assertions.assertEquals(OS.LINUX, model.os()); + Assertions.assertEquals(Architecture.ARM, model.architecture()); + Assertions.assertEquals(Variant.V7, model.variant()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/PlatformUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/PlatformUpdateParametersTests.java new file mode 100644 index 000000000000..392526221cbf --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/PlatformUpdateParametersTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.Architecture; +import com.azure.resourcemanager.containerregistry.tasks.models.OS; +import com.azure.resourcemanager.containerregistry.tasks.models.PlatformUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.Variant; +import org.junit.jupiter.api.Assertions; + +public final class PlatformUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlatformUpdateParameters model + = BinaryData.fromString("{\"os\":\"Windows\",\"architecture\":\"arm64\",\"variant\":\"v8\"}") + .toObject(PlatformUpdateParameters.class); + Assertions.assertEquals(OS.WINDOWS, model.os()); + Assertions.assertEquals(Architecture.ARM64, model.architecture()); + Assertions.assertEquals(Variant.V8, model.variant()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlatformUpdateParameters model = new PlatformUpdateParameters().withOs(OS.WINDOWS) + .withArchitecture(Architecture.ARM64) + .withVariant(Variant.V8); + model = BinaryData.fromObject(model).toObject(PlatformUpdateParameters.class); + Assertions.assertEquals(OS.WINDOWS, model.os()); + Assertions.assertEquals(Architecture.ARM64, model.architecture()); + Assertions.assertEquals(Variant.V8, model.variant()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesGetBuildSourceUploadUrlWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesGetBuildSourceUploadUrlWithResponseMockTests.java new file mode 100644 index 000000000000..1f84b55b5551 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RegistriesGetBuildSourceUploadUrlWithResponseMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceUploadDefinition; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RegistriesGetBuildSourceUploadUrlWithResponseMockTests { + @Test + public void testGetBuildSourceUploadUrlWithResponse() throws Exception { + String responseStr = "{\"uploadUrl\":\"ccybvp\",\"relativePath\":\"akkud\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + SourceUploadDefinition response = manager.registries() + .getBuildSourceUploadUrlWithResponse("yvudtjuewbci", "xuuwhcj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ccybvp", response.uploadUrl()); + Assertions.assertEquals("akkud", response.relativePath()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunGetLogResultInnerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunGetLogResultInnerTests.java new file mode 100644 index 000000000000..908ba8b9a3d3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunGetLogResultInnerTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.RunGetLogResultInner; +import org.junit.jupiter.api.Assertions; + +public final class RunGetLogResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RunGetLogResultInner model = BinaryData.fromString("{\"logLink\":\"yggdtjixh\",\"logArtifactLink\":\"uofqwe\"}") + .toObject(RunGetLogResultInner.class); + Assertions.assertEquals("yggdtjixh", model.logLink()); + Assertions.assertEquals("uofqwe", model.logArtifactLink()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunRequestTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunRequestTests.java new file mode 100644 index 000000000000..059f7b648aec --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunRequestTests.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import org.junit.jupiter.api.Assertions; + +public final class RunRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RunRequest model = BinaryData.fromString( + "{\"type\":\"RunRequest\",\"isArchiveEnabled\":true,\"agentPoolName\":\"vf\",\"logTemplate\":\"kymuctqhjfbebr\"}") + .toObject(RunRequest.class); + Assertions.assertTrue(model.isArchiveEnabled()); + Assertions.assertEquals("vf", model.agentPoolName()); + Assertions.assertEquals("kymuctqhjfbebr", model.logTemplate()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RunRequest model + = new RunRequest().withIsArchiveEnabled(true).withAgentPoolName("vf").withLogTemplate("kymuctqhjfbebr"); + model = BinaryData.fromObject(model).toObject(RunRequest.class); + Assertions.assertTrue(model.isArchiveEnabled()); + Assertions.assertEquals("vf", model.agentPoolName()); + Assertions.assertEquals("kymuctqhjfbebr", model.logTemplate()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunUpdateParametersTests.java new file mode 100644 index 000000000000..1e3dcaeb699a --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunUpdateParametersTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.RunUpdateParameters; +import org.junit.jupiter.api.Assertions; + +public final class RunUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RunUpdateParameters model + = BinaryData.fromString("{\"isArchiveEnabled\":true}").toObject(RunUpdateParameters.class); + Assertions.assertTrue(model.isArchiveEnabled()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RunUpdateParameters model = new RunUpdateParameters().withIsArchiveEnabled(true); + model = BinaryData.fromObject(model).toObject(RunUpdateParameters.class); + Assertions.assertTrue(model.isArchiveEnabled()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsCancelWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsCancelWithResponseMockTests.java new file mode 100644 index 000000000000..a3909c881934 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsCancelWithResponseMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RunsCancelWithResponseMockTests { + @Test + public void testCancelWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.runs().cancelWithResponse("drhneuyow", "kdw", "t", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetLogSasUrlWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetLogSasUrlWithResponseMockTests.java new file mode 100644 index 000000000000..a775fdfbc598 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/RunsGetLogSasUrlWithResponseMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import com.azure.resourcemanager.containerregistry.tasks.models.RunGetLogResult; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RunsGetLogSasUrlWithResponseMockTests { + @Test + public void testGetLogSasUrlWithResponse() throws Exception { + String responseStr = "{\"logLink\":\"paslthaqfxssmwu\",\"logArtifactLink\":\"bdsrez\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RunGetLogResult response = manager.runs() + .getLogSasUrlWithResponse("lbjbsyb", "qwrvtldgmfp", "vm", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("paslthaqfxssmwu", response.logLink()); + Assertions.assertEquals("bdsrez", response.logArtifactLink()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SecretObjectTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SecretObjectTests.java new file mode 100644 index 000000000000..c2dd333bae5a --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SecretObjectTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObject; +import com.azure.resourcemanager.containerregistry.tasks.models.SecretObjectType; +import org.junit.jupiter.api.Assertions; + +public final class SecretObjectTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SecretObject model + = BinaryData.fromString("{\"value\":\"vtq\",\"type\":\"Opaque\"}").toObject(SecretObject.class); + Assertions.assertEquals("vtq", model.value()); + Assertions.assertEquals(SecretObjectType.OPAQUE, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SecretObject model = new SecretObject().withValue("vtq").withType(SecretObjectType.OPAQUE); + model = BinaryData.fromObject(model).toObject(SecretObject.class); + Assertions.assertEquals("vtq", model.value()); + Assertions.assertEquals(SecretObjectType.OPAQUE, model.type()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceRegistryCredentialsTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceRegistryCredentialsTests.java new file mode 100644 index 000000000000..92caa76fa458 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceRegistryCredentialsTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryCredentials; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceRegistryLoginMode; +import org.junit.jupiter.api.Assertions; + +public final class SourceRegistryCredentialsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SourceRegistryCredentials model + = BinaryData.fromString("{\"identity\":\"zpuzycisp\",\"loginMode\":\"Default\"}") + .toObject(SourceRegistryCredentials.class); + Assertions.assertEquals("zpuzycisp", model.identity()); + Assertions.assertEquals(SourceRegistryLoginMode.DEFAULT, model.loginMode()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SourceRegistryCredentials model + = new SourceRegistryCredentials().withIdentity("zpuzycisp").withLoginMode(SourceRegistryLoginMode.DEFAULT); + model = BinaryData.fromObject(model).toObject(SourceRegistryCredentials.class); + Assertions.assertEquals("zpuzycisp", model.identity()); + Assertions.assertEquals(SourceRegistryLoginMode.DEFAULT, model.loginMode()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceTriggerDescriptorTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceTriggerDescriptorTests.java new file mode 100644 index 000000000000..8149843a67cd --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceTriggerDescriptorTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.SourceTriggerDescriptor; +import org.junit.jupiter.api.Assertions; + +public final class SourceTriggerDescriptorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SourceTriggerDescriptor model = BinaryData.fromString( + "{\"id\":\"utqxlngx\",\"eventType\":\"fgugnxkrxdqmid\",\"commitId\":\"hzrvqd\",\"pullRequestId\":\"bhj\",\"repositoryUrl\":\"igeho\",\"branchName\":\"bowsk\",\"providerType\":\"yktz\"}") + .toObject(SourceTriggerDescriptor.class); + Assertions.assertEquals("utqxlngx", model.id()); + Assertions.assertEquals("fgugnxkrxdqmid", model.eventType()); + Assertions.assertEquals("hzrvqd", model.commitId()); + Assertions.assertEquals("bhj", model.pullRequestId()); + Assertions.assertEquals("igeho", model.repositoryUrl()); + Assertions.assertEquals("bowsk", model.branchName()); + Assertions.assertEquals("yktz", model.providerType()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceUploadDefinitionInnerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceUploadDefinitionInnerTests.java new file mode 100644 index 000000000000..f38dc60b2583 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/SourceUploadDefinitionInnerTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.SourceUploadDefinitionInner; +import org.junit.jupiter.api.Assertions; + +public final class SourceUploadDefinitionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SourceUploadDefinitionInner model + = BinaryData.fromString("{\"uploadUrl\":\"kpzksmondjmq\",\"relativePath\":\"vypomgkopkwho\"}") + .toObject(SourceUploadDefinitionInner.class); + Assertions.assertEquals("kpzksmondjmq", model.uploadUrl()); + Assertions.assertEquals("vypomgkopkwho", model.relativePath()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunPropertiesUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunPropertiesUpdateParametersTests.java new file mode 100644 index 000000000000..8ca44e98dda7 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunPropertiesUpdateParametersTests.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.fluent.models.TaskRunPropertiesUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import org.junit.jupiter.api.Assertions; + +public final class TaskRunPropertiesUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TaskRunPropertiesUpdateParameters model = BinaryData.fromString( + "{\"runRequest\":{\"type\":\"RunRequest\",\"isArchiveEnabled\":true,\"agentPoolName\":\"rlhrxs\",\"logTemplate\":\"yvpycanuzbpzk\"},\"forceUpdateTag\":\"kuwbcrnwb\"}") + .toObject(TaskRunPropertiesUpdateParameters.class); + Assertions.assertTrue(model.runRequest().isArchiveEnabled()); + Assertions.assertEquals("rlhrxs", model.runRequest().agentPoolName()); + Assertions.assertEquals("yvpycanuzbpzk", model.runRequest().logTemplate()); + Assertions.assertEquals("kuwbcrnwb", model.forceUpdateTag()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TaskRunPropertiesUpdateParameters model = new TaskRunPropertiesUpdateParameters().withRunRequest( + new RunRequest().withIsArchiveEnabled(true).withAgentPoolName("rlhrxs").withLogTemplate("yvpycanuzbpzk")) + .withForceUpdateTag("kuwbcrnwb"); + model = BinaryData.fromObject(model).toObject(TaskRunPropertiesUpdateParameters.class); + Assertions.assertTrue(model.runRequest().isArchiveEnabled()); + Assertions.assertEquals("rlhrxs", model.runRequest().agentPoolName()); + Assertions.assertEquals("yvpycanuzbpzk", model.runRequest().logTemplate()); + Assertions.assertEquals("kuwbcrnwb", model.forceUpdateTag()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunUpdateParametersTests.java new file mode 100644 index 000000000000..025e7b62acca --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunUpdateParametersTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.IdentityProperties; +import com.azure.resourcemanager.containerregistry.tasks.models.ResourceIdentityType; +import com.azure.resourcemanager.containerregistry.tasks.models.RunRequest; +import com.azure.resourcemanager.containerregistry.tasks.models.TaskRunUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TaskRunUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TaskRunUpdateParameters model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"wiyighxpkdw\",\"tenantId\":\"aiuebbaumnyqu\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"tfhvpesapskrdqmh\":{\"principalId\":\"nabckhsmtx\",\"clientId\":\"ie\"},\"scwsv\":{\"principalId\":\"dhtldwkyz\",\"clientId\":\"utknc\"},\"kvceoveilovnotyf\":{\"principalId\":\"otogtwrupqs\",\"clientId\":\"nmic\"},\"oqnermclfpl\":{\"principalId\":\"cnjbkcnxdhbt\",\"clientId\":\"phywpnvj\"}}},\"properties\":{\"runRequest\":{\"type\":\"RunRequest\",\"isArchiveEnabled\":true,\"agentPoolName\":\"crpab\",\"logTemplate\":\"epsbjtazqu\"},\"forceUpdateTag\":\"ywpmueefjzwfqkq\"},\"location\":\"ids\",\"tags\":{\"tcc\":\"nobglaocq\",\"udxytlmoyrx\":\"g\",\"qj\":\"wfudwpzntxhdzhl\"}}") + .toObject(TaskRunUpdateParameters.class); + Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("ids", model.location()); + Assertions.assertEquals("nobglaocq", model.tags().get("tcc")); + Assertions.assertTrue(model.runRequest().isArchiveEnabled()); + Assertions.assertEquals("crpab", model.runRequest().agentPoolName()); + Assertions.assertEquals("epsbjtazqu", model.runRequest().logTemplate()); + Assertions.assertEquals("ywpmueefjzwfqkq", model.forceUpdateTag()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TaskRunUpdateParameters model + = new TaskRunUpdateParameters() + .withIdentity(new IdentityProperties().withType(ResourceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("tfhvpesapskrdqmh", new UserIdentityProperties(), "scwsv", + new UserIdentityProperties(), "kvceoveilovnotyf", new UserIdentityProperties(), "oqnermclfpl", + new UserIdentityProperties()))) + .withLocation("ids") + .withTags(mapOf("tcc", "nobglaocq", "udxytlmoyrx", "g", "qj", "wfudwpzntxhdzhl")) + .withRunRequest(new RunRequest().withIsArchiveEnabled(true) + .withAgentPoolName("crpab") + .withLogTemplate("epsbjtazqu")) + .withForceUpdateTag("ywpmueefjzwfqkq"); + model = BinaryData.fromObject(model).toObject(TaskRunUpdateParameters.class); + Assertions.assertEquals(ResourceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("ids", model.location()); + Assertions.assertEquals("nobglaocq", model.tags().get("tcc")); + Assertions.assertTrue(model.runRequest().isArchiveEnabled()); + Assertions.assertEquals("crpab", model.runRequest().agentPoolName()); + Assertions.assertEquals("epsbjtazqu", model.runRequest().logTemplate()); + Assertions.assertEquals("ywpmueefjzwfqkq", model.forceUpdateTag()); + } + + // Use "Map.of" if available + @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/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsDeleteWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..7c17cd23f0c9 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TaskRunsDeleteWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class TaskRunsDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.taskRuns() + .deleteWithResponse("feo", "erqwkyhkobopg", "edkowepbqpcrfk", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksDeleteWithResponseMockTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..a597b6065df1 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TasksDeleteWithResponseMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.containerregistry.tasks.ContainerRegistryTasksManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class TasksDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + ContainerRegistryTasksManager manager = ContainerRegistryTasksManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.tasks().deleteWithResponse("t", "mrtwna", "jslb", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerDescriptorTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerDescriptorTests.java new file mode 100644 index 000000000000..b384413642c3 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerDescriptorTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.TimerTriggerDescriptor; +import org.junit.jupiter.api.Assertions; + +public final class TimerTriggerDescriptorTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TimerTriggerDescriptor model + = BinaryData.fromString("{\"timerTriggerName\":\"u\",\"scheduleOccurrence\":\"wgqyw\"}") + .toObject(TimerTriggerDescriptor.class); + Assertions.assertEquals("u", model.timerTriggerName()); + Assertions.assertEquals("wgqyw", model.scheduleOccurrence()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerTests.java new file mode 100644 index 000000000000..4bd07ad70ff8 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.TimerTrigger; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerStatus; +import org.junit.jupiter.api.Assertions; + +public final class TimerTriggerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TimerTrigger model + = BinaryData.fromString("{\"schedule\":\"uoujmkcjhwqy\",\"status\":\"Disabled\",\"name\":\"ybn\"}") + .toObject(TimerTrigger.class); + Assertions.assertEquals("uoujmkcjhwqy", model.schedule()); + Assertions.assertEquals(TriggerStatus.DISABLED, model.status()); + Assertions.assertEquals("ybn", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TimerTrigger model + = new TimerTrigger().withSchedule("uoujmkcjhwqy").withStatus(TriggerStatus.DISABLED).withName("ybn"); + model = BinaryData.fromObject(model).toObject(TimerTrigger.class); + Assertions.assertEquals("uoujmkcjhwqy", model.schedule()); + Assertions.assertEquals(TriggerStatus.DISABLED, model.status()); + Assertions.assertEquals("ybn", model.name()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerUpdateParametersTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerUpdateParametersTests.java new file mode 100644 index 000000000000..c774d1c784fa --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/TimerTriggerUpdateParametersTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.TimerTriggerUpdateParameters; +import com.azure.resourcemanager.containerregistry.tasks.models.TriggerStatus; +import org.junit.jupiter.api.Assertions; + +public final class TimerTriggerUpdateParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TimerTriggerUpdateParameters model + = BinaryData.fromString("{\"schedule\":\"fcnihgwq\",\"status\":\"Disabled\",\"name\":\"edgfbcvkcvq\"}") + .toObject(TimerTriggerUpdateParameters.class); + Assertions.assertEquals("fcnihgwq", model.schedule()); + Assertions.assertEquals(TriggerStatus.DISABLED, model.status()); + Assertions.assertEquals("edgfbcvkcvq", model.name()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TimerTriggerUpdateParameters model = new TimerTriggerUpdateParameters().withSchedule("fcnihgwq") + .withStatus(TriggerStatus.DISABLED) + .withName("edgfbcvkcvq"); + model = BinaryData.fromObject(model).toObject(TimerTriggerUpdateParameters.class); + Assertions.assertEquals("fcnihgwq", model.schedule()); + Assertions.assertEquals(TriggerStatus.DISABLED, model.status()); + Assertions.assertEquals("edgfbcvkcvq", model.name()); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/UserIdentityPropertiesTests.java b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/UserIdentityPropertiesTests.java new file mode 100644 index 000000000000..40f54c4a2885 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/src/test/java/com/azure/resourcemanager/containerregistry/tasks/generated/UserIdentityPropertiesTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.containerregistry.tasks.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.containerregistry.tasks.models.UserIdentityProperties; + +public final class UserIdentityPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserIdentityProperties model = BinaryData.fromString("{\"principalId\":\"l\",\"clientId\":\"gsxnkjzkdeslpv\"}") + .toObject(UserIdentityProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserIdentityProperties model = new UserIdentityProperties(); + model = BinaryData.fromObject(model).toObject(UserIdentityProperties.class); + } +} diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/tsp-location.yaml b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/tsp-location.yaml new file mode 100644 index 000000000000..5bd530d5e805 --- /dev/null +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry-tasks/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks +commit: b98ebeb5250e9af1846b14884677ac71aeb2be53 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry/CHANGELOG.md b/sdk/containerregistry/azure-resourcemanager-containerregistry/CHANGELOG.md index 99040f2dc72c..f605f72b72c6 100644 --- a/sdk/containerregistry/azure-resourcemanager-containerregistry/CHANGELOG.md +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 2.55.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (Unreleased) ### Breaking Changes diff --git a/sdk/containerregistry/azure-resourcemanager-containerregistry/README.md b/sdk/containerregistry/azure-resourcemanager-containerregistry/README.md index b565d807f7f0..d8d02d6d5f38 100644 --- a/sdk/containerregistry/azure-resourcemanager-containerregistry/README.md +++ b/sdk/containerregistry/azure-resourcemanager-containerregistry/README.md @@ -18,7 +18,7 @@ For documentation on how to use this package, please see [Azure Management Libra com.azure.resourcemanager azure-resourcemanager-containerregistry - 2.53.1 + 2.55.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/containerregistry/ci.yml b/sdk/containerregistry/ci.yml index 8ae2003205f3..0f989b6aa532 100644 --- a/sdk/containerregistry/ci.yml +++ b/sdk/containerregistry/ci.yml @@ -38,18 +38,22 @@ pr: - sdk/containerregistry/azure-resourcemanager-containerregistry/pom.xml parameters: -- name: release_dependsonlivetests - displayName: 'Release depends on live tests' - type: boolean - default: true -- name: release_azurecontainerscontainerregistry - displayName: 'azure-containers-containerregistry' - type: boolean - default: true -- name: release_azureresourcemanagercontainerregistry - displayName: 'azure-resourcemanager-containerregistry' - type: boolean - default: false + - name: release_dependsonlivetests + displayName: Release depends on live tests + type: boolean + default: true + - name: release_azurecontainerscontainerregistry + displayName: azure-containers-containerregistry + type: boolean + default: true + - name: release_azureresourcemanagercontainerregistry + displayName: azure-resourcemanager-containerregistry + type: boolean + default: false + - name: release_azureresourcemanagercontainerregistrytasks + displayName: azure-resourcemanager-containerregistry-tasks + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -64,9 +68,12 @@ extends: groupId: com.azure.resourcemanager safeName: azureresourcemanagercontainerregistry releaseInBatch: ${{ parameters.release_azureresourcemanagercontainerregistry }} + - name: azure-resourcemanager-containerregistry-tasks + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercontainerregistrytasks + releaseInBatch: ${{ parameters.release_azureresourcemanagercontainerregistrytasks }} AdditionalModules: - name: azure-containers-containerregistry-perf groupId: com.azure - # required by the above perf library - name: perf-test-core groupId: com.azure diff --git a/sdk/containerregistry/pom.xml b/sdk/containerregistry/pom.xml index 75c9894e38f6..9930207dd200 100644 --- a/sdk/containerregistry/pom.xml +++ b/sdk/containerregistry/pom.xml @@ -12,5 +12,6 @@ azure-containers-containerregistry azure-containers-containerregistry-perf azure-resourcemanager-containerregistry + azure-resourcemanager-containerregistry-tasks