diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 342f84b97c16..054c1df553bb 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -300,6 +300,7 @@ com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-botservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-scheduler;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 8a459dd59a62..30f0219a1112 100644 --- a/pom.xml +++ b/pom.xml @@ -707,6 +707,7 @@ eng/code-quality-reports eng/jacoco-test-coverage sdk/advisor + sdk/agrifood sdk/anomalydetector sdk/apimanagement sdk/appconfiguration @@ -751,7 +752,6 @@ sdk/digitaltwins sdk/eventgrid sdk/eventhubs - sdk/agrifood sdk/formrecognizer sdk/frontdoor sdk/hanaonazure @@ -800,6 +800,7 @@ sdk/resourcehealth sdk/resourcemanager sdk/resourcemover + sdk/scheduler sdk/schemaregistry sdk/search sdk/servicebus diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/CHANGELOG.md b/sdk/scheduler/azure-resourcemanager-scheduler/CHANGELOG.md new file mode 100644 index 000000000000..a99a329f66e9 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-07-02) + +- Azure Resource Manager Scheduler client library for Java. This package contains Microsoft Azure SDK for Scheduler Management SDK. Package tag package-2016-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/README.md b/sdk/scheduler/azure-resourcemanager-scheduler/README.md new file mode 100644 index 000000000000..ebccd2dcd863 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager Scheduler client library for Java + +Azure Resource Manager Scheduler client library for Java. + +This package contains Microsoft Azure SDK for Scheduler Management SDK. Package tag package-2016-03. 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-scheduler;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-scheduler + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +SchedulerManager manager = SchedulerManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/pom.xml b/sdk/scheduler/azure-resourcemanager-scheduler/pom.xml new file mode 100644 index 000000000000..680d761c26a8 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-scheduler + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Scheduler Management + This package contains Microsoft Azure SDK for Scheduler Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2016-03. + 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 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/SchedulerManager.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/SchedulerManager.java new file mode 100644 index 000000000000..f87909172f68 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/SchedulerManager.java @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler; + +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.policy.AddDatePolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.fluent.SchedulerManagementClient; +import com.azure.resourcemanager.scheduler.implementation.JobCollectionsImpl; +import com.azure.resourcemanager.scheduler.implementation.JobsImpl; +import com.azure.resourcemanager.scheduler.implementation.SchedulerManagementClientBuilder; +import com.azure.resourcemanager.scheduler.models.JobCollections; +import com.azure.resourcemanager.scheduler.models.Jobs; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to SchedulerManager. */ +public final class SchedulerManager { + private JobCollections jobCollections; + + private Jobs jobs; + + private final SchedulerManagementClient clientObject; + + private SchedulerManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new SchedulerManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Scheduler service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Scheduler service API instance. + */ + public static SchedulerManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create SchedulerManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new SchedulerManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Scheduler service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Scheduler service API instance. + */ + public SchedulerManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.scheduler") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new SchedulerManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of JobCollections. */ + public JobCollections jobCollections() { + if (this.jobCollections == null) { + this.jobCollections = new JobCollectionsImpl(clientObject.getJobCollections(), this); + } + return jobCollections; + } + + /** @return Resource collection API of Jobs. */ + public Jobs jobs() { + if (this.jobs == null) { + this.jobs = new JobsImpl(clientObject.getJobs(), this); + } + return jobs; + } + + /** + * @return Wrapped service client SchedulerManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public SchedulerManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/JobCollectionsClient.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/JobCollectionsClient.java new file mode 100644 index 000000000000..87b0c86f7e6f --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/JobCollectionsClient.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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.scheduler.fluent.models.JobCollectionDefinitionInner; + +/** An instance of this class provides access to all the operations defined in JobCollectionsClient. */ +public interface JobCollectionsClient { + /** + * Gets all job collections under specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets all job collections under specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCollectionDefinitionInner getByResourceGroup(String resourceGroupName, String jobCollectionName); + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String jobCollectionName, Context context); + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCollectionDefinitionInner createOrUpdate( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection); + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String jobCollectionName, + JobCollectionDefinitionInner jobCollection, + Context context); + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobCollectionDefinitionInner patch( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection); + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response patchWithResponse( + String resourceGroupName, + String jobCollectionName, + JobCollectionDefinitionInner jobCollection, + Context context); + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String jobCollectionName); + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String jobCollectionName, Context context); + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 jobCollectionName); + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 jobCollectionName, Context context); + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginEnable(String resourceGroupName, String jobCollectionName); + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginEnable(String resourceGroupName, String jobCollectionName, Context context); + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 enable(String resourceGroupName, String jobCollectionName); + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 enable(String resourceGroupName, String jobCollectionName, Context context); + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDisable(String resourceGroupName, String jobCollectionName); + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDisable( + String resourceGroupName, String jobCollectionName, Context context); + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 disable(String resourceGroupName, String jobCollectionName); + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 disable(String resourceGroupName, String jobCollectionName, Context context); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/JobsClient.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/JobsClient.java new file mode 100644 index 000000000000..9a924d8f60ca --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/JobsClient.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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.scheduler.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public interface JobsClient { + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobDefinitionInner get(String resourceGroupName, String jobCollectionName, String jobName); + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context); + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobDefinitionInner createOrUpdate( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job); + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job, Context context); + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + JobDefinitionInner patch( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job); + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response patchWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job, Context context); + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 jobCollectionName, String jobName); + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context); + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 run(String resourceGroupName, String jobCollectionName, String jobName); + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response runWithResponse(String resourceGroupName, String jobCollectionName, String jobName, Context context); + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String jobCollectionName); + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter, Context context); + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listJobHistory( + String resourceGroupName, String jobCollectionName, String jobName); + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listJobHistory( + String resourceGroupName, + String jobCollectionName, + String jobName, + Integer top, + Integer skip, + String filter, + Context context); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/SchedulerManagementClient.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/SchedulerManagementClient.java new file mode 100644 index 000000000000..4b7418011d94 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/SchedulerManagementClient.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for SchedulerManagementClient class. */ +public interface SchedulerManagementClient { + /** + * Gets The subscription id. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the JobCollectionsClient object to access its operations. + * + * @return the JobCollectionsClient object. + */ + JobCollectionsClient getJobCollections(); + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + JobsClient getJobs(); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobCollectionDefinitionInner.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobCollectionDefinitionInner.java new file mode 100644 index 000000000000..358bfb123141 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobCollectionDefinitionInner.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.models.JobCollectionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The JobCollectionDefinition model. */ +@Fluent +public final class JobCollectionDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCollectionDefinitionInner.class); + + /* + * Gets the job collection resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Gets the job collection resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Gets or sets the job collection resource name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Gets or sets the storage account location. + */ + @JsonProperty(value = "location") + private String location; + + /* + * Gets or sets the tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Gets or sets the job collection properties. + */ + @JsonProperty(value = "properties") + private JobCollectionProperties properties; + + /** + * Get the id property: Gets the job collection resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: Gets the job collection resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: Gets or sets the job collection resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Gets or sets the job collection resource name. + * + * @param name the name value to set. + * @return the JobCollectionDefinitionInner object itself. + */ + public JobCollectionDefinitionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the location property: Gets or sets the storage account location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Gets or sets the storage account location. + * + * @param location the location value to set. + * @return the JobCollectionDefinitionInner object itself. + */ + public JobCollectionDefinitionInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Gets or sets the tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Gets or sets the tags. + * + * @param tags the tags value to set. + * @return the JobCollectionDefinitionInner object itself. + */ + public JobCollectionDefinitionInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Gets or sets the job collection properties. + * + * @return the properties value. + */ + public JobCollectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Gets or sets the job collection properties. + * + * @param properties the properties value to set. + * @return the JobCollectionDefinitionInner object itself. + */ + public JobCollectionDefinitionInner withProperties(JobCollectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobDefinitionInner.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobDefinitionInner.java new file mode 100644 index 000000000000..fab24afe512d --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobDefinitionInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.models.JobProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobDefinition model. */ +@Fluent +public final class JobDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobDefinitionInner.class); + + /* + * Gets the job resource identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Gets the job resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Gets the job resource name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Gets or sets the job properties. + */ + @JsonProperty(value = "properties") + private JobProperties properties; + + /** + * Get the id property: Gets the job resource identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: Gets the job resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: Gets the job resource name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the properties property: Gets or sets the job properties. + * + * @return the properties value. + */ + public JobProperties properties() { + return this.properties; + } + + /** + * Set the properties property: Gets or sets the job properties. + * + * @param properties the properties value to set. + * @return the JobDefinitionInner object itself. + */ + public JobDefinitionInner withProperties(JobProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobHistoryDefinitionInner.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobHistoryDefinitionInner.java new file mode 100644 index 000000000000..8c198ae5c912 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/JobHistoryDefinitionInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.models.JobHistoryDefinitionProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobHistoryDefinition model. */ +@Immutable +public final class JobHistoryDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobHistoryDefinitionInner.class); + + /* + * Gets the job history identifier. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Gets the job history resource type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * Gets the job history name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Gets or sets the job history properties. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private JobHistoryDefinitionProperties properties; + + /** + * Get the id property: Gets the job history identifier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: Gets the job history resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: Gets the job history name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the properties property: Gets or sets the job history properties. + * + * @return the properties value. + */ + public JobHistoryDefinitionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/package-info.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/package-info.java new file mode 100644 index 000000000000..9bdb0100b81a --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for SchedulerManagementClient. null. */ +package com.azure.resourcemanager.scheduler.fluent.models; diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/package-info.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/package-info.java new file mode 100644 index 000000000000..b65714ae2851 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for SchedulerManagementClient. null. */ +package com.azure.resourcemanager.scheduler.fluent; diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionDefinitionImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionDefinitionImpl.java new file mode 100644 index 000000000000..2d2c20e07293 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionDefinitionImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scheduler.fluent.models.JobCollectionDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobCollectionDefinition; +import com.azure.resourcemanager.scheduler.models.JobCollectionProperties; +import java.util.Collections; +import java.util.Map; + +public final class JobCollectionDefinitionImpl + implements JobCollectionDefinition, JobCollectionDefinition.Definition, JobCollectionDefinition.Update { + private JobCollectionDefinitionInner innerObject; + + private final com.azure.resourcemanager.scheduler.SchedulerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + 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 JobCollectionProperties properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public JobCollectionDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scheduler.SchedulerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String jobCollectionName; + + public JobCollectionDefinitionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public JobCollectionDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCollections() + .createOrUpdateWithResponse(resourceGroupName, jobCollectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobCollectionDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCollections() + .createOrUpdateWithResponse(resourceGroupName, jobCollectionName, this.innerModel(), context) + .getValue(); + return this; + } + + JobCollectionDefinitionImpl(String name, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerObject = new JobCollectionDefinitionInner(); + this.serviceManager = serviceManager; + this.jobCollectionName = name; + } + + public JobCollectionDefinitionImpl update() { + return this; + } + + public JobCollectionDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCollections() + .patchWithResponse(resourceGroupName, jobCollectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobCollectionDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCollections() + .patchWithResponse(resourceGroupName, jobCollectionName, this.innerModel(), context) + .getValue(); + return this; + } + + JobCollectionDefinitionImpl( + JobCollectionDefinitionInner innerObject, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.jobCollectionName = Utils.getValueFromIdByName(innerObject.id(), "jobCollections"); + } + + public JobCollectionDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobCollections() + .getByResourceGroupWithResponse(resourceGroupName, jobCollectionName, Context.NONE) + .getValue(); + return this; + } + + public JobCollectionDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobCollections() + .getByResourceGroupWithResponse(resourceGroupName, jobCollectionName, context) + .getValue(); + return this; + } + + public void enable() { + serviceManager.jobCollections().enable(resourceGroupName, jobCollectionName); + } + + public void enable(Context context) { + serviceManager.jobCollections().enable(resourceGroupName, jobCollectionName, context); + } + + public void disable() { + serviceManager.jobCollections().disable(resourceGroupName, jobCollectionName); + } + + public void disable(Context context) { + serviceManager.jobCollections().disable(resourceGroupName, jobCollectionName, context); + } + + public JobCollectionDefinitionImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public JobCollectionDefinitionImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public JobCollectionDefinitionImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public JobCollectionDefinitionImpl withName(String name) { + this.innerModel().withName(name); + return this; + } + + public JobCollectionDefinitionImpl withProperties(JobCollectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionsClientImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionsClientImpl.java new file mode 100644 index 000000000000..998b48f2d738 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionsClientImpl.java @@ -0,0 +1,1843 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.scheduler.fluent.JobCollectionsClient; +import com.azure.resourcemanager.scheduler.fluent.models.JobCollectionDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobCollectionListResult; +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 JobCollectionsClient. */ +public final class JobCollectionsClientImpl implements JobCollectionsClient { + private final ClientLogger logger = new ClientLogger(JobCollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobCollectionsService service; + + /** The service client containing this operation class. */ + private final SchedulerManagementClientImpl client; + + /** + * Initializes an instance of JobCollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobCollectionsClientImpl(SchedulerManagementClientImpl client) { + this.service = + RestProxy.create(JobCollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SchedulerManagementClientJobCollections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SchedulerManagementC") + private interface JobCollectionsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Scheduler/jobCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobCollectionDefinitionInner jobCollection, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> patch( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobCollectionDefinitionInner jobCollection, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/enable") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> enable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/disable") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> disable( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets all job collections under specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all job collections under specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all job collections under specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets all job collections under specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all job collections under specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets all job collections under specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String jobCollectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String jobCollectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String jobCollectionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, jobCollectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCollectionDefinitionInner getByResourceGroup(String resourceGroupName, String jobCollectionName) { + return getByResourceGroupAsync(resourceGroupName, jobCollectionName).block(); + } + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String jobCollectionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, jobCollectionName, context).block(); + } + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobCollection == null) { + return Mono.error(new IllegalArgumentException("Parameter jobCollection is required and cannot be null.")); + } else { + jobCollection.validate(); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + jobCollection, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String jobCollectionName, + JobCollectionDefinitionInner jobCollection, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobCollection == null) { + return Mono.error(new IllegalArgumentException("Parameter jobCollection is required and cannot be null.")); + } else { + jobCollection.validate(); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + jobCollection, + accept, + context); + } + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection) { + return createOrUpdateWithResponseAsync(resourceGroupName, jobCollectionName, jobCollection) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCollectionDefinitionInner createOrUpdate( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection) { + return createOrUpdateAsync(resourceGroupName, jobCollectionName, jobCollection).block(); + } + + /** + * Provisions a new job collection or updates an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String jobCollectionName, + JobCollectionDefinitionInner jobCollection, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, jobCollectionName, jobCollection, context).block(); + } + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobCollection == null) { + return Mono.error(new IllegalArgumentException("Parameter jobCollection is required and cannot be null.")); + } else { + jobCollection.validate(); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .patch( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + jobCollection, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync( + String resourceGroupName, + String jobCollectionName, + JobCollectionDefinitionInner jobCollection, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobCollection == null) { + return Mono.error(new IllegalArgumentException("Parameter jobCollection is required and cannot be null.")); + } else { + jobCollection.validate(); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .patch( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + jobCollection, + accept, + context); + } + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono patchAsync( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection) { + return patchWithResponseAsync(resourceGroupName, jobCollectionName, jobCollection) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobCollectionDefinitionInner patch( + String resourceGroupName, String jobCollectionName, JobCollectionDefinitionInner jobCollection) { + return patchAsync(resourceGroupName, jobCollectionName, jobCollection).block(); + } + + /** + * Patches an existing job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobCollection The job collection definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchWithResponse( + String resourceGroupName, + String jobCollectionName, + JobCollectionDefinitionInner jobCollection, + Context context) { + return patchWithResponseAsync(resourceGroupName, jobCollectionName, jobCollection, context).block(); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String jobCollectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String jobCollectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String jobCollectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, jobCollectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String jobCollectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, jobCollectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String jobCollectionName) { + return beginDeleteAsync(resourceGroupName, jobCollectionName).getSyncPoller(); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String jobCollectionName, Context context) { + return beginDeleteAsync(resourceGroupName, jobCollectionName, context).getSyncPoller(); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String jobCollectionName) { + return beginDeleteAsync(resourceGroupName, jobCollectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String jobCollectionName, Context context) { + return beginDeleteAsync(resourceGroupName, jobCollectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 jobCollectionName) { + deleteAsync(resourceGroupName, jobCollectionName).block(); + } + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 jobCollectionName, Context context) { + deleteAsync(resourceGroupName, jobCollectionName, context).block(); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> enableWithResponseAsync( + String resourceGroupName, String jobCollectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .enable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> enableWithResponseAsync( + String resourceGroupName, String jobCollectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .enable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + context); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginEnableAsync(String resourceGroupName, String jobCollectionName) { + Mono>> mono = enableWithResponseAsync(resourceGroupName, jobCollectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginEnableAsync( + String resourceGroupName, String jobCollectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = enableWithResponseAsync(resourceGroupName, jobCollectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginEnable(String resourceGroupName, String jobCollectionName) { + return beginEnableAsync(resourceGroupName, jobCollectionName).getSyncPoller(); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginEnable( + String resourceGroupName, String jobCollectionName, Context context) { + return beginEnableAsync(resourceGroupName, jobCollectionName, context).getSyncPoller(); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enableAsync(String resourceGroupName, String jobCollectionName) { + return beginEnableAsync(resourceGroupName, jobCollectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enableAsync(String resourceGroupName, String jobCollectionName, Context context) { + return beginEnableAsync(resourceGroupName, jobCollectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 enable(String resourceGroupName, String jobCollectionName) { + enableAsync(resourceGroupName, jobCollectionName).block(); + } + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 enable(String resourceGroupName, String jobCollectionName, Context context) { + enableAsync(resourceGroupName, jobCollectionName, context).block(); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> disableWithResponseAsync( + String resourceGroupName, String jobCollectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .disable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> disableWithResponseAsync( + String resourceGroupName, String jobCollectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .disable( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + context); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDisableAsync(String resourceGroupName, String jobCollectionName) { + Mono>> mono = disableWithResponseAsync(resourceGroupName, jobCollectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDisableAsync( + String resourceGroupName, String jobCollectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = disableWithResponseAsync(resourceGroupName, jobCollectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDisable(String resourceGroupName, String jobCollectionName) { + return beginDisableAsync(resourceGroupName, jobCollectionName).getSyncPoller(); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDisable( + String resourceGroupName, String jobCollectionName, Context context) { + return beginDisableAsync(resourceGroupName, jobCollectionName, context).getSyncPoller(); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync(String resourceGroupName, String jobCollectionName) { + return beginDisableAsync(resourceGroupName, jobCollectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono disableAsync(String resourceGroupName, String jobCollectionName, Context context) { + return beginDisableAsync(resourceGroupName, jobCollectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 disable(String resourceGroupName, String jobCollectionName) { + disableAsync(resourceGroupName, jobCollectionName).block(); + } + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 disable(String resourceGroupName, String jobCollectionName, Context context) { + disableAsync(resourceGroupName, jobCollectionName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionsImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionsImpl.java new file mode 100644 index 000000000000..b6c015aff422 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobCollectionsImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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.scheduler.fluent.JobCollectionsClient; +import com.azure.resourcemanager.scheduler.fluent.models.JobCollectionDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobCollectionDefinition; +import com.azure.resourcemanager.scheduler.models.JobCollections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobCollectionsImpl implements JobCollections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCollectionsImpl.class); + + private final JobCollectionsClient innerClient; + + private final com.azure.resourcemanager.scheduler.SchedulerManager serviceManager; + + public JobCollectionsImpl( + JobCollectionsClient innerClient, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new JobCollectionDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new JobCollectionDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new JobCollectionDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new JobCollectionDefinitionImpl(inner1, this.manager())); + } + + public JobCollectionDefinition getByResourceGroup(String resourceGroupName, String jobCollectionName) { + JobCollectionDefinitionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, jobCollectionName); + if (inner != null) { + return new JobCollectionDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String jobCollectionName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, jobCollectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobCollectionDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String jobCollectionName) { + this.serviceClient().delete(resourceGroupName, jobCollectionName); + } + + public void delete(String resourceGroupName, String jobCollectionName, Context context) { + this.serviceClient().delete(resourceGroupName, jobCollectionName, context); + } + + public void enable(String resourceGroupName, String jobCollectionName) { + this.serviceClient().enable(resourceGroupName, jobCollectionName); + } + + public void enable(String resourceGroupName, String jobCollectionName, Context context) { + this.serviceClient().enable(resourceGroupName, jobCollectionName, context); + } + + public void disable(String resourceGroupName, String jobCollectionName) { + this.serviceClient().disable(resourceGroupName, jobCollectionName); + } + + public void disable(String resourceGroupName, String jobCollectionName, Context context) { + this.serviceClient().disable(resourceGroupName, jobCollectionName, context); + } + + public JobCollectionDefinition getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, jobCollectionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, jobCollectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + this.delete(resourceGroupName, jobCollectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + this.delete(resourceGroupName, jobCollectionName, context); + } + + private JobCollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scheduler.SchedulerManager manager() { + return this.serviceManager; + } + + public JobCollectionDefinitionImpl define(String name) { + return new JobCollectionDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobDefinitionImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobDefinitionImpl.java new file mode 100644 index 000000000000..2d89632aa445 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobDefinitionImpl.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scheduler.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobDefinition; +import com.azure.resourcemanager.scheduler.models.JobProperties; + +public final class JobDefinitionImpl implements JobDefinition, JobDefinition.Definition, JobDefinition.Update { + private JobDefinitionInner innerObject; + + private final com.azure.resourcemanager.scheduler.SchedulerManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public JobProperties properties() { + return this.innerModel().properties(); + } + + public JobDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scheduler.SchedulerManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String jobCollectionName; + + private String jobName; + + public JobDefinitionImpl withExistingJobCollection(String resourceGroupName, String jobCollectionName) { + this.resourceGroupName = resourceGroupName; + this.jobCollectionName = jobCollectionName; + return this; + } + + public JobDefinition create() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse( + resourceGroupName, jobCollectionName, jobName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobDefinition create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .createOrUpdateWithResponse(resourceGroupName, jobCollectionName, jobName, this.innerModel(), context) + .getValue(); + return this; + } + + JobDefinitionImpl(String name, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerObject = new JobDefinitionInner(); + this.serviceManager = serviceManager; + this.jobName = name; + } + + public JobDefinitionImpl update() { + return this; + } + + public JobDefinition apply() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .patchWithResponse(resourceGroupName, jobCollectionName, jobName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public JobDefinition apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .patchWithResponse(resourceGroupName, jobCollectionName, jobName, this.innerModel(), context) + .getValue(); + return this; + } + + JobDefinitionImpl( + JobDefinitionInner innerObject, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.jobCollectionName = Utils.getValueFromIdByName(innerObject.id(), "jobCollections"); + this.jobName = Utils.getValueFromIdByName(innerObject.id(), "jobs"); + } + + public JobDefinition refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .getWithResponse(resourceGroupName, jobCollectionName, jobName, Context.NONE) + .getValue(); + return this; + } + + public JobDefinition refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getJobs() + .getWithResponse(resourceGroupName, jobCollectionName, jobName, context) + .getValue(); + return this; + } + + public void run() { + serviceManager.jobs().run(resourceGroupName, jobCollectionName, jobName); + } + + public Response runWithResponse(Context context) { + return serviceManager.jobs().runWithResponse(resourceGroupName, jobCollectionName, jobName, context); + } + + public JobDefinitionImpl withProperties(JobProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobHistoryDefinitionImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobHistoryDefinitionImpl.java new file mode 100644 index 000000000000..8507173dc059 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobHistoryDefinitionImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.implementation; + +import com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobHistoryDefinition; +import com.azure.resourcemanager.scheduler.models.JobHistoryDefinitionProperties; + +public final class JobHistoryDefinitionImpl implements JobHistoryDefinition { + private JobHistoryDefinitionInner innerObject; + + private final com.azure.resourcemanager.scheduler.SchedulerManager serviceManager; + + JobHistoryDefinitionImpl( + JobHistoryDefinitionInner innerObject, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public JobHistoryDefinitionProperties properties() { + return this.innerModel().properties(); + } + + public JobHistoryDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.scheduler.SchedulerManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobsClientImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobsClientImpl.java new file mode 100644 index 000000000000..11d643abb602 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobsClientImpl.java @@ -0,0 +1,1675 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.fluent.JobsClient; +import com.azure.resourcemanager.scheduler.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobHistoryListResult; +import com.azure.resourcemanager.scheduler.models.JobListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in JobsClient. */ +public final class JobsClientImpl implements JobsClient { + private final ClientLogger logger = new ClientLogger(JobsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final JobsService service; + + /** The service client containing this operation class. */ + private final SchedulerManagementClientImpl client; + + /** + * Initializes an instance of JobsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + JobsClientImpl(SchedulerManagementClientImpl client) { + this.service = RestProxy.create(JobsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for SchedulerManagementClientJobs to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "SchedulerManagementC") + private interface JobsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs/{jobName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @PathParam("jobName") String jobName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs/{jobName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @PathParam("jobName") String jobName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobDefinitionInner job, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs/{jobName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> patch( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @PathParam("jobName") String jobName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") JobDefinitionInner job, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs/{jobName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @PathParam("jobName") String jobName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs/{jobName}/run") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> run( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @PathParam("jobName") String jobName, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Scheduler" + + "/jobCollections/{jobCollectionName}/jobs/{jobName}/history") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listJobHistory( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("jobCollectionName") String jobCollectionName, + @PathParam("jobName") String jobName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$top") Integer top, + @QueryParam("$skip") Integer skip, + @QueryParam("$filter") String filter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listJobHistoryNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String jobCollectionName, String jobName) { + return getWithResponseAsync(resourceGroupName, jobCollectionName, jobName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobDefinitionInner get(String resourceGroupName, String jobCollectionName, String jobName) { + return getAsync(resourceGroupName, jobCollectionName, jobName).block(); + } + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + return getWithResponseAsync(resourceGroupName, jobCollectionName, jobName, context).block(); + } + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (job == null) { + return Mono.error(new IllegalArgumentException("Parameter job is required and cannot be null.")); + } else { + job.validate(); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + job, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (job == null) { + return Mono.error(new IllegalArgumentException("Parameter job is required and cannot be null.")); + } else { + job.validate(); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + job, + accept, + context); + } + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job) { + return createOrUpdateWithResponseAsync(resourceGroupName, jobCollectionName, jobName, job) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobDefinitionInner createOrUpdate( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job) { + return createOrUpdateAsync(resourceGroupName, jobCollectionName, jobName, job).block(); + } + + /** + * Provisions a new job or updates an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, jobCollectionName, jobName, job, context).block(); + } + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (job == null) { + return Mono.error(new IllegalArgumentException("Parameter job is required and cannot be null.")); + } else { + job.validate(); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .patch( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + job, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> patchWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + if (job == null) { + return Mono.error(new IllegalArgumentException("Parameter job is required and cannot be null.")); + } else { + job.validate(); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .patch( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + job, + accept, + context); + } + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono patchAsync( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job) { + return patchWithResponseAsync(resourceGroupName, jobCollectionName, jobName, job) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public JobDefinitionInner patch( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job) { + return patchAsync(resourceGroupName, jobCollectionName, jobName, job).block(); + } + + /** + * Patches an existing job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param job The job definition. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response patchWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, JobDefinitionInner job, Context context) { + return patchWithResponseAsync(resourceGroupName, jobCollectionName, jobName, job, context).block(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + context); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String jobCollectionName, String jobName) { + return deleteWithResponseAsync(resourceGroupName, jobCollectionName, jobName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 jobCollectionName, String jobName) { + deleteAsync(resourceGroupName, jobCollectionName, jobName).block(); + } + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + return deleteWithResponseAsync(resourceGroupName, jobCollectionName, jobName, context).block(); + } + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + return FluxUtil + .withContext( + context -> + service + .run( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> runWithResponseAsync( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + context = this.client.mergeContext(context); + return service + .run( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + context); + } + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runAsync(String resourceGroupName, String jobCollectionName, String jobName) { + return runWithResponseAsync(resourceGroupName, jobCollectionName, jobName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 run(String resourceGroupName, String jobCollectionName, String jobName) { + runAsync(resourceGroupName, jobCollectionName, jobName).block(); + } + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response runWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + return runWithResponseAsync(resourceGroupName, jobCollectionName, jobName, context).block(); + } + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + top, + skip, + filter, + 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 jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + this.client.getApiVersion(), + top, + skip, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, jobCollectionName, top, skip, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String jobCollectionName) { + final Integer top = null; + final Integer skip = null; + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, jobCollectionName, top, skip, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, jobCollectionName, top, skip, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String jobCollectionName) { + final Integer top = null; + final Integer skip = null; + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, jobCollectionName, top, skip, filter)); + } + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, jobCollectionName, top, skip, filter, context)); + } + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobHistorySinglePageAsync( + String resourceGroupName, String jobCollectionName, String jobName, Integer top, Integer skip, String filter) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext( + context -> + service + .listJobHistory( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + top, + skip, + filter, + 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 job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobHistorySinglePageAsync( + String resourceGroupName, + String jobCollectionName, + String jobName, + Integer top, + Integer skip, + String filter, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (jobCollectionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter jobCollectionName is required and cannot be null.")); + } + if (jobName == null) { + return Mono.error(new IllegalArgumentException("Parameter jobName is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listJobHistory( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + jobCollectionName, + jobName, + this.client.getApiVersion(), + top, + skip, + filter, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listJobHistoryAsync( + String resourceGroupName, String jobCollectionName, String jobName, Integer top, Integer skip, String filter) { + return new PagedFlux<>( + () -> listJobHistorySinglePageAsync(resourceGroupName, jobCollectionName, jobName, top, skip, filter), + nextLink -> listJobHistoryNextSinglePageAsync(nextLink)); + } + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listJobHistoryAsync( + String resourceGroupName, String jobCollectionName, String jobName) { + final Integer top = null; + final Integer skip = null; + final String filter = null; + return new PagedFlux<>( + () -> listJobHistorySinglePageAsync(resourceGroupName, jobCollectionName, jobName, top, skip, filter), + nextLink -> listJobHistoryNextSinglePageAsync(nextLink)); + } + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listJobHistoryAsync( + String resourceGroupName, + String jobCollectionName, + String jobName, + Integer top, + Integer skip, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listJobHistorySinglePageAsync( + resourceGroupName, jobCollectionName, jobName, top, skip, filter, context), + nextLink -> listJobHistoryNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listJobHistory( + String resourceGroupName, String jobCollectionName, String jobName) { + final Integer top = null; + final Integer skip = null; + final String filter = null; + return new PagedIterable<>( + listJobHistoryAsync(resourceGroupName, jobCollectionName, jobName, top, skip, filter)); + } + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listJobHistory( + String resourceGroupName, + String jobCollectionName, + String jobName, + Integer top, + Integer skip, + String filter, + Context context) { + return new PagedIterable<>( + listJobHistoryAsync(resourceGroupName, jobCollectionName, jobName, top, skip, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobHistoryNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + return FluxUtil + .withContext(context -> service.listJobHistoryNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listJobHistoryNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json, text/json"; + context = this.client.mergeContext(context); + return service + .listJobHistoryNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobsImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobsImpl.java new file mode 100644 index 000000000000..c919271f2553 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/JobsImpl.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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.scheduler.fluent.JobsClient; +import com.azure.resourcemanager.scheduler.fluent.models.JobDefinitionInner; +import com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner; +import com.azure.resourcemanager.scheduler.models.JobDefinition; +import com.azure.resourcemanager.scheduler.models.JobHistoryDefinition; +import com.azure.resourcemanager.scheduler.models.Jobs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class JobsImpl implements Jobs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobsImpl.class); + + private final JobsClient innerClient; + + private final com.azure.resourcemanager.scheduler.SchedulerManager serviceManager; + + public JobsImpl(JobsClient innerClient, com.azure.resourcemanager.scheduler.SchedulerManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public JobDefinition get(String resourceGroupName, String jobCollectionName, String jobName) { + JobDefinitionInner inner = this.serviceClient().get(resourceGroupName, jobCollectionName, jobName); + if (inner != null) { + return new JobDefinitionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, jobCollectionName, jobName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new JobDefinitionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String jobCollectionName, String jobName) { + this.serviceClient().delete(resourceGroupName, jobCollectionName, jobName); + } + + public Response deleteWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, jobCollectionName, jobName, context); + } + + public void run(String resourceGroupName, String jobCollectionName, String jobName) { + this.serviceClient().run(resourceGroupName, jobCollectionName, jobName); + } + + public Response runWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context) { + return this.serviceClient().runWithResponse(resourceGroupName, jobCollectionName, jobName, context); + } + + public PagedIterable list(String resourceGroupName, String jobCollectionName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, jobCollectionName); + return Utils.mapPage(inner, inner1 -> new JobDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, jobCollectionName, top, skip, filter, context); + return Utils.mapPage(inner, inner1 -> new JobDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listJobHistory( + String resourceGroupName, String jobCollectionName, String jobName) { + PagedIterable inner = + this.serviceClient().listJobHistory(resourceGroupName, jobCollectionName, jobName); + return Utils.mapPage(inner, inner1 -> new JobHistoryDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable listJobHistory( + String resourceGroupName, + String jobCollectionName, + String jobName, + Integer top, + Integer skip, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .listJobHistory(resourceGroupName, jobCollectionName, jobName, top, skip, filter, context); + return Utils.mapPage(inner, inner1 -> new JobHistoryDefinitionImpl(inner1, this.manager())); + } + + public JobDefinition getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.getWithResponse(resourceGroupName, jobCollectionName, jobName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.getWithResponse(resourceGroupName, jobCollectionName, jobName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + this.deleteWithResponse(resourceGroupName, jobCollectionName, jobName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String jobCollectionName = Utils.getValueFromIdByName(id, "jobCollections"); + if (jobCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'jobCollections'.", id))); + } + String jobName = Utils.getValueFromIdByName(id, "jobs"); + if (jobName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'jobs'.", id))); + } + return this.deleteWithResponse(resourceGroupName, jobCollectionName, jobName, context); + } + + private JobsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.scheduler.SchedulerManager manager() { + return this.serviceManager; + } + + public JobDefinitionImpl define(String name) { + return new JobDefinitionImpl(name, this.manager()); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/SchedulerManagementClientBuilder.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/SchedulerManagementClientBuilder.java new file mode 100644 index 000000000000..88694c3954d2 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/SchedulerManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the SchedulerManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {SchedulerManagementClientImpl.class}) +public final class SchedulerManagementClientBuilder { + /* + * The subscription id. + */ + private String subscriptionId; + + /** + * Sets The subscription id. + * + * @param subscriptionId the subscriptionId value. + * @return the SchedulerManagementClientBuilder. + */ + public SchedulerManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the SchedulerManagementClientBuilder. + */ + public SchedulerManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the SchedulerManagementClientBuilder. + */ + public SchedulerManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the SchedulerManagementClientBuilder. + */ + public SchedulerManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the SchedulerManagementClientBuilder. + */ + public SchedulerManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the SchedulerManagementClientBuilder. + */ + public SchedulerManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of SchedulerManagementClientImpl with the provided parameters. + * + * @return an instance of SchedulerManagementClientImpl. + */ + public SchedulerManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + SchedulerManagementClientImpl client = + new SchedulerManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/SchedulerManagementClientImpl.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/SchedulerManagementClientImpl.java new file mode 100644 index 000000000000..816fa1ca4b68 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/SchedulerManagementClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.scheduler.fluent.JobCollectionsClient; +import com.azure.resourcemanager.scheduler.fluent.JobsClient; +import com.azure.resourcemanager.scheduler.fluent.SchedulerManagementClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the SchedulerManagementClientImpl type. */ +@ServiceClient(builder = SchedulerManagementClientBuilder.class) +public final class SchedulerManagementClientImpl implements SchedulerManagementClient { + private final ClientLogger logger = new ClientLogger(SchedulerManagementClientImpl.class); + + /** The subscription id. */ + private final String subscriptionId; + + /** + * Gets The subscription id. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The JobCollectionsClient object to access its operations. */ + private final JobCollectionsClient jobCollections; + + /** + * Gets the JobCollectionsClient object to access its operations. + * + * @return the JobCollectionsClient object. + */ + public JobCollectionsClient getJobCollections() { + return this.jobCollections; + } + + /** The JobsClient object to access its operations. */ + private final JobsClient jobs; + + /** + * Gets the JobsClient object to access its operations. + * + * @return the JobsClient object. + */ + public JobsClient getJobs() { + return this.jobs; + } + + /** + * Initializes an instance of SchedulerManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The subscription id. + * @param endpoint server parameter. + */ + SchedulerManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2016-03-01"; + this.jobCollections = new JobCollectionsClientImpl(this); + this.jobs = new JobsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/Utils.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/Utils.java new file mode 100644 index 000000000000..6eda7ac540a6 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/package-info.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/package-info.java new file mode 100644 index 000000000000..8f04de48f7b5 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for SchedulerManagementClient. null. */ +package com.azure.resourcemanager.scheduler.implementation; diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/BasicAuthentication.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/BasicAuthentication.java new file mode 100644 index 000000000000..00323646f6f0 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/BasicAuthentication.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The BasicAuthentication model. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Basic") +@Fluent +public final class BasicAuthentication extends HttpAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BasicAuthentication.class); + + /* + * Gets or sets the username. + */ + @JsonProperty(value = "username") + private String username; + + /* + * Gets or sets the password, return value will always be empty. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the username property: Gets or sets the username. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: Gets or sets the username. + * + * @param username the username value to set. + * @return the BasicAuthentication object itself. + */ + public BasicAuthentication withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: Gets or sets the password, return value will always be empty. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Gets or sets the password, return value will always be empty. + * + * @param password the password value to set. + * @return the BasicAuthentication object itself. + */ + public BasicAuthentication withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ClientCertAuthentication.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ClientCertAuthentication.java new file mode 100644 index 000000000000..cb8577859277 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ClientCertAuthentication.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; + +/** The ClientCertAuthentication model. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ClientCertificate") +@Fluent +public final class ClientCertAuthentication extends HttpAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ClientCertAuthentication.class); + + /* + * Gets or sets the certificate password, return value will always be + * empty. + */ + @JsonProperty(value = "password") + private String password; + + /* + * Gets or sets the pfx certificate. Accepts certification in base64 + * encoding, return value will always be empty. + */ + @JsonProperty(value = "pfx") + private String pfx; + + /* + * Gets or sets the certificate thumbprint. + */ + @JsonProperty(value = "certificateThumbprint") + private String certificateThumbprint; + + /* + * Gets or sets the certificate expiration date. + */ + @JsonProperty(value = "certificateExpirationDate") + private OffsetDateTime certificateExpirationDate; + + /* + * Gets or sets the certificate subject name. + */ + @JsonProperty(value = "certificateSubjectName") + private String certificateSubjectName; + + /** + * Get the password property: Gets or sets the certificate password, return value will always be empty. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: Gets or sets the certificate password, return value will always be empty. + * + * @param password the password value to set. + * @return the ClientCertAuthentication object itself. + */ + public ClientCertAuthentication withPassword(String password) { + this.password = password; + return this; + } + + /** + * Get the pfx property: Gets or sets the pfx certificate. Accepts certification in base64 encoding, return value + * will always be empty. + * + * @return the pfx value. + */ + public String pfx() { + return this.pfx; + } + + /** + * Set the pfx property: Gets or sets the pfx certificate. Accepts certification in base64 encoding, return value + * will always be empty. + * + * @param pfx the pfx value to set. + * @return the ClientCertAuthentication object itself. + */ + public ClientCertAuthentication withPfx(String pfx) { + this.pfx = pfx; + return this; + } + + /** + * Get the certificateThumbprint property: Gets or sets the certificate thumbprint. + * + * @return the certificateThumbprint value. + */ + public String certificateThumbprint() { + return this.certificateThumbprint; + } + + /** + * Set the certificateThumbprint property: Gets or sets the certificate thumbprint. + * + * @param certificateThumbprint the certificateThumbprint value to set. + * @return the ClientCertAuthentication object itself. + */ + public ClientCertAuthentication withCertificateThumbprint(String certificateThumbprint) { + this.certificateThumbprint = certificateThumbprint; + return this; + } + + /** + * Get the certificateExpirationDate property: Gets or sets the certificate expiration date. + * + * @return the certificateExpirationDate value. + */ + public OffsetDateTime certificateExpirationDate() { + return this.certificateExpirationDate; + } + + /** + * Set the certificateExpirationDate property: Gets or sets the certificate expiration date. + * + * @param certificateExpirationDate the certificateExpirationDate value to set. + * @return the ClientCertAuthentication object itself. + */ + public ClientCertAuthentication withCertificateExpirationDate(OffsetDateTime certificateExpirationDate) { + this.certificateExpirationDate = certificateExpirationDate; + return this; + } + + /** + * Get the certificateSubjectName property: Gets or sets the certificate subject name. + * + * @return the certificateSubjectName value. + */ + public String certificateSubjectName() { + return this.certificateSubjectName; + } + + /** + * Set the certificateSubjectName property: Gets or sets the certificate subject name. + * + * @param certificateSubjectName the certificateSubjectName value to set. + * @return the ClientCertAuthentication object itself. + */ + public ClientCertAuthentication withCertificateSubjectName(String certificateSubjectName) { + this.certificateSubjectName = certificateSubjectName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/DayOfWeek.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/DayOfWeek.java new file mode 100644 index 000000000000..faef46e01506 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/DayOfWeek.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for DayOfWeek. */ +public enum DayOfWeek { + /** Enum value Sunday. */ + SUNDAY("Sunday"), + + /** Enum value Monday. */ + MONDAY("Monday"), + + /** Enum value Tuesday. */ + TUESDAY("Tuesday"), + + /** Enum value Wednesday. */ + WEDNESDAY("Wednesday"), + + /** Enum value Thursday. */ + THURSDAY("Thursday"), + + /** Enum value Friday. */ + FRIDAY("Friday"), + + /** Enum value Saturday. */ + SATURDAY("Saturday"); + + /** The actual serialized value for a DayOfWeek instance. */ + private final String value; + + DayOfWeek(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a DayOfWeek instance. + * + * @param value the serialized value to parse. + * @return the parsed DayOfWeek object, or null if unable to parse. + */ + @JsonCreator + public static DayOfWeek fromString(String value) { + DayOfWeek[] items = DayOfWeek.values(); + for (DayOfWeek item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpAuthentication.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpAuthentication.java new file mode 100644 index 000000000000..1ee897f864a8 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpAuthentication.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The HttpAuthentication model. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = HttpAuthentication.class) +@JsonTypeName("HttpAuthentication") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ClientCertificate", value = ClientCertAuthentication.class), + @JsonSubTypes.Type(name = "Basic", value = BasicAuthentication.class), + @JsonSubTypes.Type(name = "ActiveDirectoryOAuth", value = OAuthAuthentication.class) +}) +@Immutable +public class HttpAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpAuthentication.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpAuthenticationType.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpAuthenticationType.java new file mode 100644 index 000000000000..620fe42a754b --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpAuthenticationType.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for HttpAuthenticationType. */ +public enum HttpAuthenticationType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value ClientCertificate. */ + CLIENT_CERTIFICATE("ClientCertificate"), + + /** Enum value ActiveDirectoryOAuth. */ + ACTIVE_DIRECTORY_OAUTH("ActiveDirectoryOAuth"), + + /** Enum value Basic. */ + BASIC("Basic"); + + /** The actual serialized value for a HttpAuthenticationType instance. */ + private final String value; + + HttpAuthenticationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a HttpAuthenticationType instance. + * + * @param value the serialized value to parse. + * @return the parsed HttpAuthenticationType object, or null if unable to parse. + */ + @JsonCreator + public static HttpAuthenticationType fromString(String value) { + HttpAuthenticationType[] items = HttpAuthenticationType.values(); + for (HttpAuthenticationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpRequest.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpRequest.java new file mode 100644 index 000000000000..4e157a36619b --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/HttpRequest.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The HttpRequest model. */ +@Fluent +public final class HttpRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpRequest.class); + + /* + * Gets or sets the authentication method of the request. + */ + @JsonProperty(value = "authentication") + private HttpAuthentication authentication; + + /* + * Gets or sets the URI of the request. + */ + @JsonProperty(value = "uri") + private String uri; + + /* + * Gets or sets the method of the request. + */ + @JsonProperty(value = "method") + private String method; + + /* + * Gets or sets the request body. + */ + @JsonProperty(value = "body") + private String body; + + /* + * Gets or sets the headers. + */ + @JsonProperty(value = "headers") + private Map headers; + + /** + * Get the authentication property: Gets or sets the authentication method of the request. + * + * @return the authentication value. + */ + public HttpAuthentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: Gets or sets the authentication method of the request. + * + * @param authentication the authentication value to set. + * @return the HttpRequest object itself. + */ + public HttpRequest withAuthentication(HttpAuthentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the uri property: Gets or sets the URI of the request. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: Gets or sets the URI of the request. + * + * @param uri the uri value to set. + * @return the HttpRequest object itself. + */ + public HttpRequest withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the method property: Gets or sets the method of the request. + * + * @return the method value. + */ + public String method() { + return this.method; + } + + /** + * Set the method property: Gets or sets the method of the request. + * + * @param method the method value to set. + * @return the HttpRequest object itself. + */ + public HttpRequest withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get the body property: Gets or sets the request body. + * + * @return the body value. + */ + public String body() { + return this.body; + } + + /** + * Set the body property: Gets or sets the request body. + * + * @param body the body value to set. + * @return the HttpRequest object itself. + */ + public HttpRequest withBody(String body) { + this.body = body; + return this; + } + + /** + * Get the headers property: Gets or sets the headers. + * + * @return the headers value. + */ + public Map headers() { + return this.headers; + } + + /** + * Set the headers property: Gets or sets the headers. + * + * @param headers the headers value to set. + * @return the HttpRequest object itself. + */ + public HttpRequest withHeaders(Map headers) { + this.headers = headers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authentication() != null) { + authentication().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobAction.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobAction.java new file mode 100644 index 000000000000..2fac3fc263ee --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobAction.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobAction model. */ +@Fluent +public final class JobAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobAction.class); + + /* + * Gets or sets the job action type. + */ + @JsonProperty(value = "type") + private JobActionType type; + + /* + * Gets or sets the http requests. + */ + @JsonProperty(value = "request") + private HttpRequest request; + + /* + * Gets or sets the storage queue message. + */ + @JsonProperty(value = "queueMessage") + private StorageQueueMessage queueMessage; + + /* + * Gets or sets the service bus queue message. + */ + @JsonProperty(value = "serviceBusQueueMessage") + private ServiceBusQueueMessage serviceBusQueueMessage; + + /* + * Gets or sets the service bus topic message. + */ + @JsonProperty(value = "serviceBusTopicMessage") + private ServiceBusTopicMessage serviceBusTopicMessage; + + /* + * Gets or sets the retry policy. + */ + @JsonProperty(value = "retryPolicy") + private RetryPolicy retryPolicy; + + /* + * Gets or sets the error action. + */ + @JsonProperty(value = "errorAction") + private JobErrorAction errorAction; + + /** + * Get the type property: Gets or sets the job action type. + * + * @return the type value. + */ + public JobActionType type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the job action type. + * + * @param type the type value to set. + * @return the JobAction object itself. + */ + public JobAction withType(JobActionType type) { + this.type = type; + return this; + } + + /** + * Get the request property: Gets or sets the http requests. + * + * @return the request value. + */ + public HttpRequest request() { + return this.request; + } + + /** + * Set the request property: Gets or sets the http requests. + * + * @param request the request value to set. + * @return the JobAction object itself. + */ + public JobAction withRequest(HttpRequest request) { + this.request = request; + return this; + } + + /** + * Get the queueMessage property: Gets or sets the storage queue message. + * + * @return the queueMessage value. + */ + public StorageQueueMessage queueMessage() { + return this.queueMessage; + } + + /** + * Set the queueMessage property: Gets or sets the storage queue message. + * + * @param queueMessage the queueMessage value to set. + * @return the JobAction object itself. + */ + public JobAction withQueueMessage(StorageQueueMessage queueMessage) { + this.queueMessage = queueMessage; + return this; + } + + /** + * Get the serviceBusQueueMessage property: Gets or sets the service bus queue message. + * + * @return the serviceBusQueueMessage value. + */ + public ServiceBusQueueMessage serviceBusQueueMessage() { + return this.serviceBusQueueMessage; + } + + /** + * Set the serviceBusQueueMessage property: Gets or sets the service bus queue message. + * + * @param serviceBusQueueMessage the serviceBusQueueMessage value to set. + * @return the JobAction object itself. + */ + public JobAction withServiceBusQueueMessage(ServiceBusQueueMessage serviceBusQueueMessage) { + this.serviceBusQueueMessage = serviceBusQueueMessage; + return this; + } + + /** + * Get the serviceBusTopicMessage property: Gets or sets the service bus topic message. + * + * @return the serviceBusTopicMessage value. + */ + public ServiceBusTopicMessage serviceBusTopicMessage() { + return this.serviceBusTopicMessage; + } + + /** + * Set the serviceBusTopicMessage property: Gets or sets the service bus topic message. + * + * @param serviceBusTopicMessage the serviceBusTopicMessage value to set. + * @return the JobAction object itself. + */ + public JobAction withServiceBusTopicMessage(ServiceBusTopicMessage serviceBusTopicMessage) { + this.serviceBusTopicMessage = serviceBusTopicMessage; + return this; + } + + /** + * Get the retryPolicy property: Gets or sets the retry policy. + * + * @return the retryPolicy value. + */ + public RetryPolicy retryPolicy() { + return this.retryPolicy; + } + + /** + * Set the retryPolicy property: Gets or sets the retry policy. + * + * @param retryPolicy the retryPolicy value to set. + * @return the JobAction object itself. + */ + public JobAction withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Get the errorAction property: Gets or sets the error action. + * + * @return the errorAction value. + */ + public JobErrorAction errorAction() { + return this.errorAction; + } + + /** + * Set the errorAction property: Gets or sets the error action. + * + * @param errorAction the errorAction value to set. + * @return the JobAction object itself. + */ + public JobAction withErrorAction(JobErrorAction errorAction) { + this.errorAction = errorAction; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (request() != null) { + request().validate(); + } + if (queueMessage() != null) { + queueMessage().validate(); + } + if (serviceBusQueueMessage() != null) { + serviceBusQueueMessage().validate(); + } + if (serviceBusTopicMessage() != null) { + serviceBusTopicMessage().validate(); + } + if (retryPolicy() != null) { + retryPolicy().validate(); + } + if (errorAction() != null) { + errorAction().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobActionType.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobActionType.java new file mode 100644 index 000000000000..97acb10df3cc --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobActionType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobActionType. */ +public enum JobActionType { + /** Enum value Http. */ + HTTP("Http"), + + /** Enum value Https. */ + HTTPS("Https"), + + /** Enum value StorageQueue. */ + STORAGE_QUEUE("StorageQueue"), + + /** Enum value ServiceBusQueue. */ + SERVICE_BUS_QUEUE("ServiceBusQueue"), + + /** Enum value ServiceBusTopic. */ + SERVICE_BUS_TOPIC("ServiceBusTopic"); + + /** The actual serialized value for a JobActionType instance. */ + private final String value; + + JobActionType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobActionType instance. + * + * @param value the serialized value to parse. + * @return the parsed JobActionType object, or null if unable to parse. + */ + @JsonCreator + public static JobActionType fromString(String value) { + JobActionType[] items = JobActionType.values(); + for (JobActionType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionDefinition.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionDefinition.java new file mode 100644 index 000000000000..e464a78abd26 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionDefinition.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scheduler.fluent.models.JobCollectionDefinitionInner; +import java.util.Map; + +/** An immutable client-side representation of JobCollectionDefinition. */ +public interface JobCollectionDefinition { + /** + * Gets the id property: Gets the job collection resource identifier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: Gets the job collection resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Gets or sets the job collection resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the location property: Gets or sets the storage account location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Gets or sets the tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: Gets or sets the job collection properties. + * + * @return the properties value. + */ + JobCollectionProperties properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.scheduler.fluent.models.JobCollectionDefinitionInner object. + * + * @return the inner object. + */ + JobCollectionDefinitionInner innerModel(); + + /** The entirety of the JobCollectionDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The JobCollectionDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the JobCollectionDefinition definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the JobCollectionDefinition definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The resource group name. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the JobCollectionDefinition 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.WithTags, + DefinitionStages.WithName, + DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobCollectionDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobCollectionDefinition create(Context context); + } + /** The stage of the JobCollectionDefinition definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location Gets or sets the storage account location. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location Gets or sets the storage account location. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the JobCollectionDefinition definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Gets or sets the tags.. + * + * @param tags Gets or sets the tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the JobCollectionDefinition definition allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Gets or sets the job collection resource name.. + * + * @param name Gets or sets the job collection resource name. + * @return the next definition stage. + */ + WithCreate withName(String name); + } + /** The stage of the JobCollectionDefinition definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Gets or sets the job collection properties.. + * + * @param properties Gets or sets the job collection properties. + * @return the next definition stage. + */ + WithCreate withProperties(JobCollectionProperties properties); + } + } + /** + * Begins update for the JobCollectionDefinition resource. + * + * @return the stage of resource update. + */ + JobCollectionDefinition.Update update(); + + /** The template for JobCollectionDefinition update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithName, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobCollectionDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobCollectionDefinition apply(Context context); + } + /** The JobCollectionDefinition update stages. */ + interface UpdateStages { + /** The stage of the JobCollectionDefinition update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Gets or sets the tags.. + * + * @param tags Gets or sets the tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the JobCollectionDefinition update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: Gets or sets the job collection resource name.. + * + * @param name Gets or sets the job collection resource name. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the JobCollectionDefinition update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Gets or sets the job collection properties.. + * + * @param properties Gets or sets the job collection properties. + * @return the next definition stage. + */ + Update withProperties(JobCollectionProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobCollectionDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobCollectionDefinition refresh(Context context); + + /** + * Enables all of the jobs in the job collection. + * + * @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 enable(); + + /** + * Enables all of the jobs in the job collection. + * + * @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 enable(Context context); + + /** + * Disables all of the jobs in the job collection. + * + * @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 disable(); + + /** + * Disables all of the jobs in the job collection. + * + * @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 disable(Context context); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionListResult.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionListResult.java new file mode 100644 index 000000000000..72119003f4a8 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionListResult.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.fluent.models.JobCollectionDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JobCollectionListResult model. */ +@Fluent +public final class JobCollectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCollectionListResult.class); + + /* + * Gets the job collections. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Gets or sets the URL to get the next set of job collections. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets the job collections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Gets or sets the URL to get the next set of job collections. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL to get the next set of job collections. + * + * @param nextLink the nextLink value to set. + * @return the JobCollectionListResult object itself. + */ + public JobCollectionListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionProperties.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionProperties.java new file mode 100644 index 000000000000..856995272af1 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionProperties.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobCollectionProperties model. */ +@Fluent +public final class JobCollectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCollectionProperties.class); + + /* + * Gets or sets the SKU. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Gets or sets the state. + */ + @JsonProperty(value = "state") + private JobCollectionState state; + + /* + * Gets or sets the job collection quota. + */ + @JsonProperty(value = "quota") + private JobCollectionQuota quota; + + /** + * Get the sku property: Gets or sets the SKU. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: Gets or sets the SKU. + * + * @param sku the sku value to set. + * @return the JobCollectionProperties object itself. + */ + public JobCollectionProperties withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the state property: Gets or sets the state. + * + * @return the state value. + */ + public JobCollectionState state() { + return this.state; + } + + /** + * Set the state property: Gets or sets the state. + * + * @param state the state value to set. + * @return the JobCollectionProperties object itself. + */ + public JobCollectionProperties withState(JobCollectionState state) { + this.state = state; + return this; + } + + /** + * Get the quota property: Gets or sets the job collection quota. + * + * @return the quota value. + */ + public JobCollectionQuota quota() { + return this.quota; + } + + /** + * Set the quota property: Gets or sets the job collection quota. + * + * @param quota the quota value to set. + * @return the JobCollectionProperties object itself. + */ + public JobCollectionProperties withQuota(JobCollectionQuota quota) { + this.quota = quota; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (quota() != null) { + quota().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionQuota.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionQuota.java new file mode 100644 index 000000000000..f55fdd0dcf83 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionQuota.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobCollectionQuota model. */ +@Fluent +public final class JobCollectionQuota { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobCollectionQuota.class); + + /* + * Gets or set the maximum job count. + */ + @JsonProperty(value = "maxJobCount") + private Integer maxJobCount; + + /* + * Gets or sets the maximum job occurrence. + */ + @JsonProperty(value = "maxJobOccurrence") + private Integer maxJobOccurrence; + + /* + * Gets or set the maximum recurrence. + */ + @JsonProperty(value = "maxRecurrence") + private JobMaxRecurrence maxRecurrence; + + /** + * Get the maxJobCount property: Gets or set the maximum job count. + * + * @return the maxJobCount value. + */ + public Integer maxJobCount() { + return this.maxJobCount; + } + + /** + * Set the maxJobCount property: Gets or set the maximum job count. + * + * @param maxJobCount the maxJobCount value to set. + * @return the JobCollectionQuota object itself. + */ + public JobCollectionQuota withMaxJobCount(Integer maxJobCount) { + this.maxJobCount = maxJobCount; + return this; + } + + /** + * Get the maxJobOccurrence property: Gets or sets the maximum job occurrence. + * + * @return the maxJobOccurrence value. + */ + public Integer maxJobOccurrence() { + return this.maxJobOccurrence; + } + + /** + * Set the maxJobOccurrence property: Gets or sets the maximum job occurrence. + * + * @param maxJobOccurrence the maxJobOccurrence value to set. + * @return the JobCollectionQuota object itself. + */ + public JobCollectionQuota withMaxJobOccurrence(Integer maxJobOccurrence) { + this.maxJobOccurrence = maxJobOccurrence; + return this; + } + + /** + * Get the maxRecurrence property: Gets or set the maximum recurrence. + * + * @return the maxRecurrence value. + */ + public JobMaxRecurrence maxRecurrence() { + return this.maxRecurrence; + } + + /** + * Set the maxRecurrence property: Gets or set the maximum recurrence. + * + * @param maxRecurrence the maxRecurrence value to set. + * @return the JobCollectionQuota object itself. + */ + public JobCollectionQuota withMaxRecurrence(JobMaxRecurrence maxRecurrence) { + this.maxRecurrence = maxRecurrence; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (maxRecurrence() != null) { + maxRecurrence().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionState.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionState.java new file mode 100644 index 000000000000..9d028f522926 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollectionState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobCollectionState. */ +public enum JobCollectionState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Suspended. */ + SUSPENDED("Suspended"), + + /** Enum value Deleted. */ + DELETED("Deleted"); + + /** The actual serialized value for a JobCollectionState instance. */ + private final String value; + + JobCollectionState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobCollectionState instance. + * + * @param value the serialized value to parse. + * @return the parsed JobCollectionState object, or null if unable to parse. + */ + @JsonCreator + public static JobCollectionState fromString(String value) { + JobCollectionState[] items = JobCollectionState.values(); + for (JobCollectionState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollections.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollections.java new file mode 100644 index 000000000000..db069b510159 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobCollections.java @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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 JobCollections. */ +public interface JobCollections { + /** + * Gets all job collections under specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + PagedIterable list(); + + /** + * Gets all job collections under specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all job collections under specified subscription. + */ + PagedIterable list(Context context); + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets all job collections under specified resource group. + * + * @param resourceGroupName The resource group name. + * @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 job collections under specified resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + JobCollectionDefinition getByResourceGroup(String resourceGroupName, String jobCollectionName); + + /** + * Gets a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 job collection. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String jobCollectionName, Context context); + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String jobCollectionName); + + /** + * Deletes a job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 jobCollectionName, Context context); + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 enable(String resourceGroupName, String jobCollectionName); + + /** + * Enables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 enable(String resourceGroupName, String jobCollectionName, Context context); + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 disable(String resourceGroupName, String jobCollectionName); + + /** + * Disables all of the jobs in the job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @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 disable(String resourceGroupName, String jobCollectionName, Context context); + + /** + * Gets a job collection. + * + * @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 a job collection. + */ + JobCollectionDefinition getById(String id); + + /** + * Gets a job collection. + * + * @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 a job collection. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job collection. + * + * @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 job collection. + * + * @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 JobCollectionDefinition resource. + * + * @param name resource name. + * @return the first stage of the new JobCollectionDefinition definition. + */ + JobCollectionDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobDefinition.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobDefinition.java new file mode 100644 index 000000000000..350e2ee9afdf --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobDefinition.java @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.scheduler.fluent.models.JobDefinitionInner; + +/** An immutable client-side representation of JobDefinition. */ +public interface JobDefinition { + /** + * Gets the id property: Gets the job resource identifier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: Gets the job resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Gets the job resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the properties property: Gets or sets the job properties. + * + * @return the properties value. + */ + JobProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.scheduler.fluent.models.JobDefinitionInner object. + * + * @return the inner object. + */ + JobDefinitionInner innerModel(); + + /** The entirety of the JobDefinition definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The JobDefinition definition stages. */ + interface DefinitionStages { + /** The first stage of the JobDefinition definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the JobDefinition definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, jobCollectionName. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @return the next definition stage. + */ + WithCreate withExistingJobCollection(String resourceGroupName, String jobCollectionName); + } + /** + * The stage of the JobDefinition 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.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + JobDefinition create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + JobDefinition create(Context context); + } + /** The stage of the JobDefinition definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Gets or sets the job properties.. + * + * @param properties Gets or sets the job properties. + * @return the next definition stage. + */ + WithCreate withProperties(JobProperties properties); + } + } + /** + * Begins update for the JobDefinition resource. + * + * @return the stage of resource update. + */ + JobDefinition.Update update(); + + /** The template for JobDefinition update. */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + JobDefinition apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + JobDefinition apply(Context context); + } + /** The JobDefinition update stages. */ + interface UpdateStages { + /** The stage of the JobDefinition update allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Gets or sets the job properties.. + * + * @param properties Gets or sets the job properties. + * @return the next definition stage. + */ + Update withProperties(JobProperties properties); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + JobDefinition refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + JobDefinition refresh(Context context); + + /** + * Runs a job. + * + * @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 run(); + + /** + * Runs a job. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response runWithResponse(Context context); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobErrorAction.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobErrorAction.java new file mode 100644 index 000000000000..ac7a5ac887c2 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobErrorAction.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobErrorAction model. */ +@Fluent +public final class JobErrorAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobErrorAction.class); + + /* + * Gets or sets the job error action type. + */ + @JsonProperty(value = "type") + private JobActionType type; + + /* + * Gets or sets the http requests. + */ + @JsonProperty(value = "request") + private HttpRequest request; + + /* + * Gets or sets the storage queue message. + */ + @JsonProperty(value = "queueMessage") + private StorageQueueMessage queueMessage; + + /* + * Gets or sets the service bus queue message. + */ + @JsonProperty(value = "serviceBusQueueMessage") + private ServiceBusQueueMessage serviceBusQueueMessage; + + /* + * Gets or sets the service bus topic message. + */ + @JsonProperty(value = "serviceBusTopicMessage") + private ServiceBusTopicMessage serviceBusTopicMessage; + + /* + * Gets or sets the retry policy. + */ + @JsonProperty(value = "retryPolicy") + private RetryPolicy retryPolicy; + + /** + * Get the type property: Gets or sets the job error action type. + * + * @return the type value. + */ + public JobActionType type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the job error action type. + * + * @param type the type value to set. + * @return the JobErrorAction object itself. + */ + public JobErrorAction withType(JobActionType type) { + this.type = type; + return this; + } + + /** + * Get the request property: Gets or sets the http requests. + * + * @return the request value. + */ + public HttpRequest request() { + return this.request; + } + + /** + * Set the request property: Gets or sets the http requests. + * + * @param request the request value to set. + * @return the JobErrorAction object itself. + */ + public JobErrorAction withRequest(HttpRequest request) { + this.request = request; + return this; + } + + /** + * Get the queueMessage property: Gets or sets the storage queue message. + * + * @return the queueMessage value. + */ + public StorageQueueMessage queueMessage() { + return this.queueMessage; + } + + /** + * Set the queueMessage property: Gets or sets the storage queue message. + * + * @param queueMessage the queueMessage value to set. + * @return the JobErrorAction object itself. + */ + public JobErrorAction withQueueMessage(StorageQueueMessage queueMessage) { + this.queueMessage = queueMessage; + return this; + } + + /** + * Get the serviceBusQueueMessage property: Gets or sets the service bus queue message. + * + * @return the serviceBusQueueMessage value. + */ + public ServiceBusQueueMessage serviceBusQueueMessage() { + return this.serviceBusQueueMessage; + } + + /** + * Set the serviceBusQueueMessage property: Gets or sets the service bus queue message. + * + * @param serviceBusQueueMessage the serviceBusQueueMessage value to set. + * @return the JobErrorAction object itself. + */ + public JobErrorAction withServiceBusQueueMessage(ServiceBusQueueMessage serviceBusQueueMessage) { + this.serviceBusQueueMessage = serviceBusQueueMessage; + return this; + } + + /** + * Get the serviceBusTopicMessage property: Gets or sets the service bus topic message. + * + * @return the serviceBusTopicMessage value. + */ + public ServiceBusTopicMessage serviceBusTopicMessage() { + return this.serviceBusTopicMessage; + } + + /** + * Set the serviceBusTopicMessage property: Gets or sets the service bus topic message. + * + * @param serviceBusTopicMessage the serviceBusTopicMessage value to set. + * @return the JobErrorAction object itself. + */ + public JobErrorAction withServiceBusTopicMessage(ServiceBusTopicMessage serviceBusTopicMessage) { + this.serviceBusTopicMessage = serviceBusTopicMessage; + return this; + } + + /** + * Get the retryPolicy property: Gets or sets the retry policy. + * + * @return the retryPolicy value. + */ + public RetryPolicy retryPolicy() { + return this.retryPolicy; + } + + /** + * Set the retryPolicy property: Gets or sets the retry policy. + * + * @param retryPolicy the retryPolicy value to set. + * @return the JobErrorAction object itself. + */ + public JobErrorAction withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = retryPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (request() != null) { + request().validate(); + } + if (queueMessage() != null) { + queueMessage().validate(); + } + if (serviceBusQueueMessage() != null) { + serviceBusQueueMessage().validate(); + } + if (serviceBusTopicMessage() != null) { + serviceBusTopicMessage().validate(); + } + if (retryPolicy() != null) { + retryPolicy().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobExecutionStatus.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobExecutionStatus.java new file mode 100644 index 000000000000..fec3c95d4182 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobExecutionStatus.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobExecutionStatus. */ +public enum JobExecutionStatus { + /** Enum value Completed. */ + COMPLETED("Completed"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Postponed. */ + POSTPONED("Postponed"); + + /** The actual serialized value for a JobExecutionStatus instance. */ + private final String value; + + JobExecutionStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobExecutionStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed JobExecutionStatus object, or null if unable to parse. + */ + @JsonCreator + public static JobExecutionStatus fromString(String value) { + JobExecutionStatus[] items = JobExecutionStatus.values(); + for (JobExecutionStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryActionName.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryActionName.java new file mode 100644 index 000000000000..6b6b99a5d672 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryActionName.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobHistoryActionName. */ +public enum JobHistoryActionName { + /** Enum value MainAction. */ + MAIN_ACTION("MainAction"), + + /** Enum value ErrorAction. */ + ERROR_ACTION("ErrorAction"); + + /** The actual serialized value for a JobHistoryActionName instance. */ + private final String value; + + JobHistoryActionName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobHistoryActionName instance. + * + * @param value the serialized value to parse. + * @return the parsed JobHistoryActionName object, or null if unable to parse. + */ + @JsonCreator + public static JobHistoryActionName fromString(String value) { + JobHistoryActionName[] items = JobHistoryActionName.values(); + for (JobHistoryActionName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryDefinition.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryDefinition.java new file mode 100644 index 000000000000..19b468968b9a --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryDefinition.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner; + +/** An immutable client-side representation of JobHistoryDefinition. */ +public interface JobHistoryDefinition { + /** + * Gets the id property: Gets the job history identifier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: Gets the job history resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: Gets the job history name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the properties property: Gets or sets the job history properties. + * + * @return the properties value. + */ + JobHistoryDefinitionProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner object. + * + * @return the inner object. + */ + JobHistoryDefinitionInner innerModel(); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryDefinitionProperties.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryDefinitionProperties.java new file mode 100644 index 000000000000..07b973961bf1 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryDefinitionProperties.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The JobHistoryDefinitionProperties model. */ +@Immutable +public final class JobHistoryDefinitionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobHistoryDefinitionProperties.class); + + /* + * Gets the start time for this job. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * Gets the end time for this job. + */ + @JsonProperty(value = "endTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime endTime; + + /* + * Gets the expected execution time for this job. + */ + @JsonProperty(value = "expectedExecutionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expectedExecutionTime; + + /* + * Gets the job history action name. + */ + @JsonProperty(value = "actionName", access = JsonProperty.Access.WRITE_ONLY) + private JobHistoryActionName actionName; + + /* + * Gets the job history status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private JobExecutionStatus status; + + /* + * Gets the message for the job history. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * Gets the retry count for job. + */ + @JsonProperty(value = "retryCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer retryCount; + + /* + * Gets the repeat count for the job. + */ + @JsonProperty(value = "repeatCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer repeatCount; + + /** + * Get the startTime property: Gets the start time for this job. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the endTime property: Gets the end time for this job. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Get the expectedExecutionTime property: Gets the expected execution time for this job. + * + * @return the expectedExecutionTime value. + */ + public OffsetDateTime expectedExecutionTime() { + return this.expectedExecutionTime; + } + + /** + * Get the actionName property: Gets the job history action name. + * + * @return the actionName value. + */ + public JobHistoryActionName actionName() { + return this.actionName; + } + + /** + * Get the status property: Gets the job history status. + * + * @return the status value. + */ + public JobExecutionStatus status() { + return this.status; + } + + /** + * Get the message property: Gets the message for the job history. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the retryCount property: Gets the retry count for job. + * + * @return the retryCount value. + */ + public Integer retryCount() { + return this.retryCount; + } + + /** + * Get the repeatCount property: Gets the repeat count for the job. + * + * @return the repeatCount value. + */ + public Integer repeatCount() { + return this.repeatCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryListResult.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryListResult.java new file mode 100644 index 000000000000..4fd5c72925cc --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobHistoryListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.fluent.models.JobHistoryDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JobHistoryListResult model. */ +@Fluent +public final class JobHistoryListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobHistoryListResult.class); + + /* + * Gets or sets the job histories under job. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets or sets the URL to get the next set of job histories. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets or sets the job histories under job. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets the job histories under job. + * + * @param value the value value to set. + * @return the JobHistoryListResult object itself. + */ + public JobHistoryListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets the URL to get the next set of job histories. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL to get the next set of job histories. + * + * @param nextLink the nextLink value to set. + * @return the JobHistoryListResult object itself. + */ + public JobHistoryListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobListResult.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobListResult.java new file mode 100644 index 000000000000..5f212bac1bbd --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobListResult.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.scheduler.fluent.models.JobDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JobListResult model. */ +@Fluent +public final class JobListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobListResult.class); + + /* + * Gets or sets all jobs under job collection. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Gets or sets the URL to get the next set of jobs. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: Gets or sets all jobs under job collection. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Gets or sets all jobs under job collection. + * + * @param value the value value to set. + * @return the JobListResult object itself. + */ + public JobListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Gets or sets the URL to get the next set of jobs. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Gets or sets the URL to get the next set of jobs. + * + * @param nextLink the nextLink value to set. + * @return the JobListResult object itself. + */ + public JobListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobMaxRecurrence.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobMaxRecurrence.java new file mode 100644 index 000000000000..9d07eb6f56cc --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobMaxRecurrence.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobMaxRecurrence model. */ +@Fluent +public final class JobMaxRecurrence { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobMaxRecurrence.class); + + /* + * Gets or sets the frequency of recurrence (second, minute, hour, day, + * week, month). + */ + @JsonProperty(value = "frequency") + private RecurrenceFrequency frequency; + + /* + * Gets or sets the interval between retries. + */ + @JsonProperty(value = "interval") + private Integer interval; + + /** + * Get the frequency property: Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). + * + * @return the frequency value. + */ + public RecurrenceFrequency frequency() { + return this.frequency; + } + + /** + * Set the frequency property: Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). + * + * @param frequency the frequency value to set. + * @return the JobMaxRecurrence object itself. + */ + public JobMaxRecurrence withFrequency(RecurrenceFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the interval property: Gets or sets the interval between retries. + * + * @return the interval value. + */ + public Integer interval() { + return this.interval; + } + + /** + * Set the interval property: Gets or sets the interval between retries. + * + * @param interval the interval value to set. + * @return the JobMaxRecurrence object itself. + */ + public JobMaxRecurrence withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobProperties.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobProperties.java new file mode 100644 index 000000000000..5e422d1b3a41 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobProperties.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The JobProperties model. */ +@Fluent +public final class JobProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobProperties.class); + + /* + * Gets or sets the job start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Gets or sets the job action. + */ + @JsonProperty(value = "action") + private JobAction action; + + /* + * Gets or sets the job recurrence. + */ + @JsonProperty(value = "recurrence") + private JobRecurrence recurrence; + + /* + * Gets or set the job state. + */ + @JsonProperty(value = "state") + private JobState state; + + /* + * Gets the job status. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private JobStatus status; + + /** + * Get the startTime property: Gets or sets the job start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Gets or sets the job start time. + * + * @param startTime the startTime value to set. + * @return the JobProperties object itself. + */ + public JobProperties withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the action property: Gets or sets the job action. + * + * @return the action value. + */ + public JobAction action() { + return this.action; + } + + /** + * Set the action property: Gets or sets the job action. + * + * @param action the action value to set. + * @return the JobProperties object itself. + */ + public JobProperties withAction(JobAction action) { + this.action = action; + return this; + } + + /** + * Get the recurrence property: Gets or sets the job recurrence. + * + * @return the recurrence value. + */ + public JobRecurrence recurrence() { + return this.recurrence; + } + + /** + * Set the recurrence property: Gets or sets the job recurrence. + * + * @param recurrence the recurrence value to set. + * @return the JobProperties object itself. + */ + public JobProperties withRecurrence(JobRecurrence recurrence) { + this.recurrence = recurrence; + return this; + } + + /** + * Get the state property: Gets or set the job state. + * + * @return the state value. + */ + public JobState state() { + return this.state; + } + + /** + * Set the state property: Gets or set the job state. + * + * @param state the state value to set. + * @return the JobProperties object itself. + */ + public JobProperties withState(JobState state) { + this.state = state; + return this; + } + + /** + * Get the status property: Gets the job status. + * + * @return the status value. + */ + public JobStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (action() != null) { + action().validate(); + } + if (recurrence() != null) { + recurrence().validate(); + } + if (status() != null) { + status().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrence.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrence.java new file mode 100644 index 000000000000..26328e4f94e1 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrence.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The JobRecurrence model. */ +@Fluent +public final class JobRecurrence { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobRecurrence.class); + + /* + * Gets or sets the frequency of recurrence (second, minute, hour, day, + * week, month). + */ + @JsonProperty(value = "frequency") + private RecurrenceFrequency frequency; + + /* + * Gets or sets the interval between retries. + */ + @JsonProperty(value = "interval") + private Integer interval; + + /* + * Gets or sets the maximum number of times that the job should run. + */ + @JsonProperty(value = "count") + private Integer count; + + /* + * Gets or sets the time at which the job will complete. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * The schedule property. + */ + @JsonProperty(value = "schedule") + private JobRecurrenceSchedule schedule; + + /** + * Get the frequency property: Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). + * + * @return the frequency value. + */ + public RecurrenceFrequency frequency() { + return this.frequency; + } + + /** + * Set the frequency property: Gets or sets the frequency of recurrence (second, minute, hour, day, week, month). + * + * @param frequency the frequency value to set. + * @return the JobRecurrence object itself. + */ + public JobRecurrence withFrequency(RecurrenceFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the interval property: Gets or sets the interval between retries. + * + * @return the interval value. + */ + public Integer interval() { + return this.interval; + } + + /** + * Set the interval property: Gets or sets the interval between retries. + * + * @param interval the interval value to set. + * @return the JobRecurrence object itself. + */ + public JobRecurrence withInterval(Integer interval) { + this.interval = interval; + return this; + } + + /** + * Get the count property: Gets or sets the maximum number of times that the job should run. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Set the count property: Gets or sets the maximum number of times that the job should run. + * + * @param count the count value to set. + * @return the JobRecurrence object itself. + */ + public JobRecurrence withCount(Integer count) { + this.count = count; + return this; + } + + /** + * Get the endTime property: Gets or sets the time at which the job will complete. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Gets or sets the time at which the job will complete. + * + * @param endTime the endTime value to set. + * @return the JobRecurrence object itself. + */ + public JobRecurrence withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the schedule property: The schedule property. + * + * @return the schedule value. + */ + public JobRecurrenceSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: The schedule property. + * + * @param schedule the schedule value to set. + * @return the JobRecurrence object itself. + */ + public JobRecurrence withSchedule(JobRecurrenceSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (schedule() != null) { + schedule().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrenceSchedule.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrenceSchedule.java new file mode 100644 index 000000000000..b6205d4a7ce8 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrenceSchedule.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The JobRecurrenceSchedule model. */ +@Fluent +public final class JobRecurrenceSchedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobRecurrenceSchedule.class); + + /* + * Gets or sets the days of the week that the job should execute on. + */ + @JsonProperty(value = "weekDays") + private List weekDays; + + /* + * Gets or sets the hours of the day that the job should execute at. + */ + @JsonProperty(value = "hours") + private List hours; + + /* + * Gets or sets the minutes of the hour that the job should execute at. + */ + @JsonProperty(value = "minutes") + private List minutes; + + /* + * Gets or sets the days of the month that the job should execute on. Must + * be between 1 and 31. + */ + @JsonProperty(value = "monthDays") + private List monthDays; + + /* + * Gets or sets the occurrences of days within a month. + */ + @JsonProperty(value = "monthlyOccurrences") + private List monthlyOccurrences; + + /** + * Get the weekDays property: Gets or sets the days of the week that the job should execute on. + * + * @return the weekDays value. + */ + public List weekDays() { + return this.weekDays; + } + + /** + * Set the weekDays property: Gets or sets the days of the week that the job should execute on. + * + * @param weekDays the weekDays value to set. + * @return the JobRecurrenceSchedule object itself. + */ + public JobRecurrenceSchedule withWeekDays(List weekDays) { + this.weekDays = weekDays; + return this; + } + + /** + * Get the hours property: Gets or sets the hours of the day that the job should execute at. + * + * @return the hours value. + */ + public List hours() { + return this.hours; + } + + /** + * Set the hours property: Gets or sets the hours of the day that the job should execute at. + * + * @param hours the hours value to set. + * @return the JobRecurrenceSchedule object itself. + */ + public JobRecurrenceSchedule withHours(List hours) { + this.hours = hours; + return this; + } + + /** + * Get the minutes property: Gets or sets the minutes of the hour that the job should execute at. + * + * @return the minutes value. + */ + public List minutes() { + return this.minutes; + } + + /** + * Set the minutes property: Gets or sets the minutes of the hour that the job should execute at. + * + * @param minutes the minutes value to set. + * @return the JobRecurrenceSchedule object itself. + */ + public JobRecurrenceSchedule withMinutes(List minutes) { + this.minutes = minutes; + return this; + } + + /** + * Get the monthDays property: Gets or sets the days of the month that the job should execute on. Must be between 1 + * and 31. + * + * @return the monthDays value. + */ + public List monthDays() { + return this.monthDays; + } + + /** + * Set the monthDays property: Gets or sets the days of the month that the job should execute on. Must be between 1 + * and 31. + * + * @param monthDays the monthDays value to set. + * @return the JobRecurrenceSchedule object itself. + */ + public JobRecurrenceSchedule withMonthDays(List monthDays) { + this.monthDays = monthDays; + return this; + } + + /** + * Get the monthlyOccurrences property: Gets or sets the occurrences of days within a month. + * + * @return the monthlyOccurrences value. + */ + public List monthlyOccurrences() { + return this.monthlyOccurrences; + } + + /** + * Set the monthlyOccurrences property: Gets or sets the occurrences of days within a month. + * + * @param monthlyOccurrences the monthlyOccurrences value to set. + * @return the JobRecurrenceSchedule object itself. + */ + public JobRecurrenceSchedule withMonthlyOccurrences( + List monthlyOccurrences) { + this.monthlyOccurrences = monthlyOccurrences; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (monthlyOccurrences() != null) { + monthlyOccurrences().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrenceScheduleMonthlyOccurrence.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrenceScheduleMonthlyOccurrence.java new file mode 100644 index 000000000000..1aed3d23b960 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobRecurrenceScheduleMonthlyOccurrence.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The JobRecurrenceScheduleMonthlyOccurrence model. */ +@Fluent +public final class JobRecurrenceScheduleMonthlyOccurrence { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobRecurrenceScheduleMonthlyOccurrence.class); + + /* + * Gets or sets the day. Must be one of monday, tuesday, wednesday, + * thursday, friday, saturday, sunday. + */ + @JsonProperty(value = "day") + private JobScheduleDay day; + + /* + * Gets or sets the occurrence. Must be between -5 and 5. + */ + @JsonProperty(value = "Occurrence") + private Integer occurrence; + + /** + * Get the day property: Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, + * saturday, sunday. + * + * @return the day value. + */ + public JobScheduleDay day() { + return this.day; + } + + /** + * Set the day property: Gets or sets the day. Must be one of monday, tuesday, wednesday, thursday, friday, + * saturday, sunday. + * + * @param day the day value to set. + * @return the JobRecurrenceScheduleMonthlyOccurrence object itself. + */ + public JobRecurrenceScheduleMonthlyOccurrence withDay(JobScheduleDay day) { + this.day = day; + return this; + } + + /** + * Get the occurrence property: Gets or sets the occurrence. Must be between -5 and 5. + * + * @return the occurrence value. + */ + public Integer occurrence() { + return this.occurrence; + } + + /** + * Set the occurrence property: Gets or sets the occurrence. Must be between -5 and 5. + * + * @param occurrence the occurrence value to set. + * @return the JobRecurrenceScheduleMonthlyOccurrence object itself. + */ + public JobRecurrenceScheduleMonthlyOccurrence withOccurrence(Integer occurrence) { + this.occurrence = occurrence; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobScheduleDay.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobScheduleDay.java new file mode 100644 index 000000000000..71be63604e15 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobScheduleDay.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobScheduleDay. */ +public enum JobScheduleDay { + /** Enum value Monday. */ + MONDAY("Monday"), + + /** Enum value Tuesday. */ + TUESDAY("Tuesday"), + + /** Enum value Wednesday. */ + WEDNESDAY("Wednesday"), + + /** Enum value Thursday. */ + THURSDAY("Thursday"), + + /** Enum value Friday. */ + FRIDAY("Friday"), + + /** Enum value Saturday. */ + SATURDAY("Saturday"), + + /** Enum value Sunday. */ + SUNDAY("Sunday"); + + /** The actual serialized value for a JobScheduleDay instance. */ + private final String value; + + JobScheduleDay(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobScheduleDay instance. + * + * @param value the serialized value to parse. + * @return the parsed JobScheduleDay object, or null if unable to parse. + */ + @JsonCreator + public static JobScheduleDay fromString(String value) { + JobScheduleDay[] items = JobScheduleDay.values(); + for (JobScheduleDay item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobState.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobState.java new file mode 100644 index 000000000000..3f53f2f5519f --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobState.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for JobState. */ +public enum JobState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value Faulted. */ + FAULTED("Faulted"), + + /** Enum value Completed. */ + COMPLETED("Completed"); + + /** The actual serialized value for a JobState instance. */ + private final String value; + + JobState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a JobState instance. + * + * @param value the serialized value to parse. + * @return the parsed JobState object, or null if unable to parse. + */ + @JsonCreator + public static JobState fromString(String value) { + JobState[] items = JobState.values(); + for (JobState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobStatus.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobStatus.java new file mode 100644 index 000000000000..8013801afda4 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/JobStatus.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The JobStatus model. */ +@Immutable +public final class JobStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JobStatus.class); + + /* + * Gets the number of times this job has executed. + */ + @JsonProperty(value = "executionCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer executionCount; + + /* + * Gets the number of times this job has failed. + */ + @JsonProperty(value = "failureCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer failureCount; + + /* + * Gets the number of faulted occurrences (occurrences that were retried + * and failed as many times as the retry policy states). + */ + @JsonProperty(value = "faultedCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer faultedCount; + + /* + * Gets the time the last occurrence executed in ISO-8601 format. Could be + * empty if job has not run yet. + */ + @JsonProperty(value = "lastExecutionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastExecutionTime; + + /* + * Gets the time of the next occurrence in ISO-8601 format. Could be empty + * if the job is completed. + */ + @JsonProperty(value = "nextExecutionTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime nextExecutionTime; + + /** + * Get the executionCount property: Gets the number of times this job has executed. + * + * @return the executionCount value. + */ + public Integer executionCount() { + return this.executionCount; + } + + /** + * Get the failureCount property: Gets the number of times this job has failed. + * + * @return the failureCount value. + */ + public Integer failureCount() { + return this.failureCount; + } + + /** + * Get the faultedCount property: Gets the number of faulted occurrences (occurrences that were retried and failed + * as many times as the retry policy states). + * + * @return the faultedCount value. + */ + public Integer faultedCount() { + return this.faultedCount; + } + + /** + * Get the lastExecutionTime property: Gets the time the last occurrence executed in ISO-8601 format. Could be empty + * if job has not run yet. + * + * @return the lastExecutionTime value. + */ + public OffsetDateTime lastExecutionTime() { + return this.lastExecutionTime; + } + + /** + * Get the nextExecutionTime property: Gets the time of the next occurrence in ISO-8601 format. Could be empty if + * the job is completed. + * + * @return the nextExecutionTime value. + */ + public OffsetDateTime nextExecutionTime() { + return this.nextExecutionTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/Jobs.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/Jobs.java new file mode 100644 index 000000000000..372ea6b97704 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/Jobs.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.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 Jobs. */ +public interface Jobs { + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + JobDefinition get(String resourceGroupName, String jobCollectionName, String jobName); + + /** + * Gets a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 job. + */ + Response getWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context); + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 jobCollectionName, String jobName); + + /** + * Deletes a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String jobCollectionName, String jobName, Context context); + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @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 run(String resourceGroupName, String jobCollectionName, String jobName); + + /** + * Runs a job. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response runWithResponse(String resourceGroupName, String jobCollectionName, String jobName, Context context); + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(String resourceGroupName, String jobCollectionName); + + /** + * Lists all jobs under the specified job collection. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param top The number of jobs to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list( + String resourceGroupName, String jobCollectionName, Integer top, Integer skip, String filter, Context context); + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listJobHistory( + String resourceGroupName, String jobCollectionName, String jobName); + + /** + * Lists job history. + * + * @param resourceGroupName The resource group name. + * @param jobCollectionName The job collection name. + * @param jobName The job name. + * @param top the number of job history to request, in the of range of [1..100]. + * @param skip The (0-based) index of the job history list from which to begin requesting entries. + * @param filter The filter to apply on the job state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listJobHistory( + String resourceGroupName, + String jobCollectionName, + String jobName, + Integer top, + Integer skip, + String filter, + Context context); + + /** + * Gets a job. + * + * @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 a job. + */ + JobDefinition getById(String id); + + /** + * Gets a job. + * + * @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 a job. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a job. + * + * @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 job. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new JobDefinition resource. + * + * @param name resource name. + * @return the first stage of the new JobDefinition definition. + */ + JobDefinition.DefinitionStages.Blank define(String name); +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/OAuthAuthentication.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/OAuthAuthentication.java new file mode 100644 index 000000000000..d7bfd252333d --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/OAuthAuthentication.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The OAuthAuthentication model. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ActiveDirectoryOAuth") +@Fluent +public final class OAuthAuthentication extends HttpAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OAuthAuthentication.class); + + /* + * Gets or sets the secret, return value will always be empty. + */ + @JsonProperty(value = "secret") + private String secret; + + /* + * Gets or sets the tenant. + */ + @JsonProperty(value = "tenant") + private String tenant; + + /* + * Gets or sets the audience. + */ + @JsonProperty(value = "audience") + private String audience; + + /* + * Gets or sets the client identifier. + */ + @JsonProperty(value = "clientId") + private String clientId; + + /** + * Get the secret property: Gets or sets the secret, return value will always be empty. + * + * @return the secret value. + */ + public String secret() { + return this.secret; + } + + /** + * Set the secret property: Gets or sets the secret, return value will always be empty. + * + * @param secret the secret value to set. + * @return the OAuthAuthentication object itself. + */ + public OAuthAuthentication withSecret(String secret) { + this.secret = secret; + return this; + } + + /** + * Get the tenant property: Gets or sets the tenant. + * + * @return the tenant value. + */ + public String tenant() { + return this.tenant; + } + + /** + * Set the tenant property: Gets or sets the tenant. + * + * @param tenant the tenant value to set. + * @return the OAuthAuthentication object itself. + */ + public OAuthAuthentication withTenant(String tenant) { + this.tenant = tenant; + return this; + } + + /** + * Get the audience property: Gets or sets the audience. + * + * @return the audience value. + */ + public String audience() { + return this.audience; + } + + /** + * Set the audience property: Gets or sets the audience. + * + * @param audience the audience value to set. + * @return the OAuthAuthentication object itself. + */ + public OAuthAuthentication withAudience(String audience) { + this.audience = audience; + return this; + } + + /** + * Get the clientId property: Gets or sets the client identifier. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Set the clientId property: Gets or sets the client identifier. + * + * @param clientId the clientId value to set. + * @return the OAuthAuthentication object itself. + */ + public OAuthAuthentication withClientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RecurrenceFrequency.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RecurrenceFrequency.java new file mode 100644 index 000000000000..58c43e874abe --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RecurrenceFrequency.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RecurrenceFrequency. */ +public enum RecurrenceFrequency { + /** Enum value Minute. */ + MINUTE("Minute"), + + /** Enum value Hour. */ + HOUR("Hour"), + + /** Enum value Day. */ + DAY("Day"), + + /** Enum value Week. */ + WEEK("Week"), + + /** Enum value Month. */ + MONTH("Month"); + + /** The actual serialized value for a RecurrenceFrequency instance. */ + private final String value; + + RecurrenceFrequency(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecurrenceFrequency instance. + * + * @param value the serialized value to parse. + * @return the parsed RecurrenceFrequency object, or null if unable to parse. + */ + @JsonCreator + public static RecurrenceFrequency fromString(String value) { + RecurrenceFrequency[] items = RecurrenceFrequency.values(); + for (RecurrenceFrequency item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RetryPolicy.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RetryPolicy.java new file mode 100644 index 000000000000..1561d3609723 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RetryPolicy.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** The RetryPolicy model. */ +@Fluent +public final class RetryPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RetryPolicy.class); + + /* + * Gets or sets the retry strategy to be used. + */ + @JsonProperty(value = "retryType") + private RetryType retryType; + + /* + * Gets or sets the retry interval between retries, specify duration in ISO + * 8601 format. + */ + @JsonProperty(value = "retryInterval") + private Duration retryInterval; + + /* + * Gets or sets the number of times a retry should be attempted. + */ + @JsonProperty(value = "retryCount") + private Integer retryCount; + + /** + * Get the retryType property: Gets or sets the retry strategy to be used. + * + * @return the retryType value. + */ + public RetryType retryType() { + return this.retryType; + } + + /** + * Set the retryType property: Gets or sets the retry strategy to be used. + * + * @param retryType the retryType value to set. + * @return the RetryPolicy object itself. + */ + public RetryPolicy withRetryType(RetryType retryType) { + this.retryType = retryType; + return this; + } + + /** + * Get the retryInterval property: Gets or sets the retry interval between retries, specify duration in ISO 8601 + * format. + * + * @return the retryInterval value. + */ + public Duration retryInterval() { + return this.retryInterval; + } + + /** + * Set the retryInterval property: Gets or sets the retry interval between retries, specify duration in ISO 8601 + * format. + * + * @param retryInterval the retryInterval value to set. + * @return the RetryPolicy object itself. + */ + public RetryPolicy withRetryInterval(Duration retryInterval) { + this.retryInterval = retryInterval; + return this; + } + + /** + * Get the retryCount property: Gets or sets the number of times a retry should be attempted. + * + * @return the retryCount value. + */ + public Integer retryCount() { + return this.retryCount; + } + + /** + * Set the retryCount property: Gets or sets the number of times a retry should be attempted. + * + * @param retryCount the retryCount value to set. + * @return the RetryPolicy object itself. + */ + public RetryPolicy withRetryCount(Integer retryCount) { + this.retryCount = retryCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RetryType.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RetryType.java new file mode 100644 index 000000000000..00576785f425 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/RetryType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RetryType. */ +public enum RetryType { + /** Enum value None. */ + NONE("None"), + + /** Enum value Fixed. */ + FIXED("Fixed"); + + /** The actual serialized value for a RetryType instance. */ + private final String value; + + RetryType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RetryType instance. + * + * @param value the serialized value to parse. + * @return the parsed RetryType object, or null if unable to parse. + */ + @JsonCreator + public static RetryType fromString(String value) { + RetryType[] items = RetryType.values(); + for (RetryType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusAuthentication.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusAuthentication.java new file mode 100644 index 000000000000..44b187338b85 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusAuthentication.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ServiceBusAuthentication model. */ +@Fluent +public final class ServiceBusAuthentication { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceBusAuthentication.class); + + /* + * Gets or sets the SAS key. + */ + @JsonProperty(value = "sasKey") + private String sasKey; + + /* + * Gets or sets the SAS key name. + */ + @JsonProperty(value = "sasKeyName") + private String sasKeyName; + + /* + * Gets or sets the authentication type. + */ + @JsonProperty(value = "type") + private ServiceBusAuthenticationType type; + + /** + * Get the sasKey property: Gets or sets the SAS key. + * + * @return the sasKey value. + */ + public String sasKey() { + return this.sasKey; + } + + /** + * Set the sasKey property: Gets or sets the SAS key. + * + * @param sasKey the sasKey value to set. + * @return the ServiceBusAuthentication object itself. + */ + public ServiceBusAuthentication withSasKey(String sasKey) { + this.sasKey = sasKey; + return this; + } + + /** + * Get the sasKeyName property: Gets or sets the SAS key name. + * + * @return the sasKeyName value. + */ + public String sasKeyName() { + return this.sasKeyName; + } + + /** + * Set the sasKeyName property: Gets or sets the SAS key name. + * + * @param sasKeyName the sasKeyName value to set. + * @return the ServiceBusAuthentication object itself. + */ + public ServiceBusAuthentication withSasKeyName(String sasKeyName) { + this.sasKeyName = sasKeyName; + return this; + } + + /** + * Get the type property: Gets or sets the authentication type. + * + * @return the type value. + */ + public ServiceBusAuthenticationType type() { + return this.type; + } + + /** + * Set the type property: Gets or sets the authentication type. + * + * @param type the type value to set. + * @return the ServiceBusAuthentication object itself. + */ + public ServiceBusAuthentication withType(ServiceBusAuthenticationType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusAuthenticationType.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusAuthenticationType.java new file mode 100644 index 000000000000..bfe294d9af61 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusAuthenticationType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ServiceBusAuthenticationType. */ +public enum ServiceBusAuthenticationType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value SharedAccessKey. */ + SHARED_ACCESS_KEY("SharedAccessKey"); + + /** The actual serialized value for a ServiceBusAuthenticationType instance. */ + private final String value; + + ServiceBusAuthenticationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServiceBusAuthenticationType instance. + * + * @param value the serialized value to parse. + * @return the parsed ServiceBusAuthenticationType object, or null if unable to parse. + */ + @JsonCreator + public static ServiceBusAuthenticationType fromString(String value) { + ServiceBusAuthenticationType[] items = ServiceBusAuthenticationType.values(); + for (ServiceBusAuthenticationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusBrokeredMessageProperties.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusBrokeredMessageProperties.java new file mode 100644 index 000000000000..a4e62ea5a0ca --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusBrokeredMessageProperties.java @@ -0,0 +1,364 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; + +/** The ServiceBusBrokeredMessageProperties model. */ +@Fluent +public final class ServiceBusBrokeredMessageProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceBusBrokeredMessageProperties.class); + + /* + * Gets or sets the content type. + */ + @JsonProperty(value = "contentType") + private String contentType; + + /* + * Gets or sets the correlation ID. + */ + @JsonProperty(value = "correlationId") + private String correlationId; + + /* + * Gets or sets the force persistence. + */ + @JsonProperty(value = "forcePersistence") + private Boolean forcePersistence; + + /* + * Gets or sets the label. + */ + @JsonProperty(value = "label") + private String label; + + /* + * Gets or sets the message ID. + */ + @JsonProperty(value = "messageId") + private String messageId; + + /* + * Gets or sets the partition key. + */ + @JsonProperty(value = "partitionKey") + private String partitionKey; + + /* + * Gets or sets the reply to. + */ + @JsonProperty(value = "replyTo") + private String replyTo; + + /* + * Gets or sets the reply to session ID. + */ + @JsonProperty(value = "replyToSessionId") + private String replyToSessionId; + + /* + * Gets or sets the scheduled enqueue time UTC. + */ + @JsonProperty(value = "scheduledEnqueueTimeUtc") + private OffsetDateTime scheduledEnqueueTimeUtc; + + /* + * Gets or sets the session ID. + */ + @JsonProperty(value = "sessionId") + private String sessionId; + + /* + * Gets or sets the time to live. + */ + @JsonProperty(value = "timeToLive") + private Duration timeToLive; + + /* + * Gets or sets the to. + */ + @JsonProperty(value = "to") + private String to; + + /* + * Gets or sets the via partition key. + */ + @JsonProperty(value = "viaPartitionKey") + private String viaPartitionKey; + + /** + * Get the contentType property: Gets or sets the content type. + * + * @return the contentType value. + */ + public String contentType() { + return this.contentType; + } + + /** + * Set the contentType property: Gets or sets the content type. + * + * @param contentType the contentType value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withContentType(String contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the correlationId property: Gets or sets the correlation ID. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: Gets or sets the correlation ID. + * + * @param correlationId the correlationId value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + /** + * Get the forcePersistence property: Gets or sets the force persistence. + * + * @return the forcePersistence value. + */ + public Boolean forcePersistence() { + return this.forcePersistence; + } + + /** + * Set the forcePersistence property: Gets or sets the force persistence. + * + * @param forcePersistence the forcePersistence value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withForcePersistence(Boolean forcePersistence) { + this.forcePersistence = forcePersistence; + return this; + } + + /** + * Get the label property: Gets or sets the label. + * + * @return the label value. + */ + public String label() { + return this.label; + } + + /** + * Set the label property: Gets or sets the label. + * + * @param label the label value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withLabel(String label) { + this.label = label; + return this; + } + + /** + * Get the messageId property: Gets or sets the message ID. + * + * @return the messageId value. + */ + public String messageId() { + return this.messageId; + } + + /** + * Set the messageId property: Gets or sets the message ID. + * + * @param messageId the messageId value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withMessageId(String messageId) { + this.messageId = messageId; + return this; + } + + /** + * Get the partitionKey property: Gets or sets the partition key. + * + * @return the partitionKey value. + */ + public String partitionKey() { + return this.partitionKey; + } + + /** + * Set the partitionKey property: Gets or sets the partition key. + * + * @param partitionKey the partitionKey value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withPartitionKey(String partitionKey) { + this.partitionKey = partitionKey; + return this; + } + + /** + * Get the replyTo property: Gets or sets the reply to. + * + * @return the replyTo value. + */ + public String replyTo() { + return this.replyTo; + } + + /** + * Set the replyTo property: Gets or sets the reply to. + * + * @param replyTo the replyTo value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withReplyTo(String replyTo) { + this.replyTo = replyTo; + return this; + } + + /** + * Get the replyToSessionId property: Gets or sets the reply to session ID. + * + * @return the replyToSessionId value. + */ + public String replyToSessionId() { + return this.replyToSessionId; + } + + /** + * Set the replyToSessionId property: Gets or sets the reply to session ID. + * + * @param replyToSessionId the replyToSessionId value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withReplyToSessionId(String replyToSessionId) { + this.replyToSessionId = replyToSessionId; + return this; + } + + /** + * Get the scheduledEnqueueTimeUtc property: Gets or sets the scheduled enqueue time UTC. + * + * @return the scheduledEnqueueTimeUtc value. + */ + public OffsetDateTime scheduledEnqueueTimeUtc() { + return this.scheduledEnqueueTimeUtc; + } + + /** + * Set the scheduledEnqueueTimeUtc property: Gets or sets the scheduled enqueue time UTC. + * + * @param scheduledEnqueueTimeUtc the scheduledEnqueueTimeUtc value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withScheduledEnqueueTimeUtc(OffsetDateTime scheduledEnqueueTimeUtc) { + this.scheduledEnqueueTimeUtc = scheduledEnqueueTimeUtc; + return this; + } + + /** + * Get the sessionId property: Gets or sets the session ID. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: Gets or sets the session ID. + * + * @param sessionId the sessionId value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the timeToLive property: Gets or sets the time to live. + * + * @return the timeToLive value. + */ + public Duration timeToLive() { + return this.timeToLive; + } + + /** + * Set the timeToLive property: Gets or sets the time to live. + * + * @param timeToLive the timeToLive value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withTimeToLive(Duration timeToLive) { + this.timeToLive = timeToLive; + return this; + } + + /** + * Get the to property: Gets or sets the to. + * + * @return the to value. + */ + public String to() { + return this.to; + } + + /** + * Set the to property: Gets or sets the to. + * + * @param to the to value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withTo(String to) { + this.to = to; + return this; + } + + /** + * Get the viaPartitionKey property: Gets or sets the via partition key. + * + * @return the viaPartitionKey value. + */ + public String viaPartitionKey() { + return this.viaPartitionKey; + } + + /** + * Set the viaPartitionKey property: Gets or sets the via partition key. + * + * @param viaPartitionKey the viaPartitionKey value to set. + * @return the ServiceBusBrokeredMessageProperties object itself. + */ + public ServiceBusBrokeredMessageProperties withViaPartitionKey(String viaPartitionKey) { + this.viaPartitionKey = viaPartitionKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusMessage.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusMessage.java new file mode 100644 index 000000000000..c20752ef6d15 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusMessage.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The ServiceBusMessage model. */ +@Fluent +public class ServiceBusMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceBusMessage.class); + + /* + * Gets or sets the Service Bus authentication. + */ + @JsonProperty(value = "authentication") + private ServiceBusAuthentication authentication; + + /* + * Gets or sets the brokered message properties. + */ + @JsonProperty(value = "brokeredMessageProperties") + private ServiceBusBrokeredMessageProperties brokeredMessageProperties; + + /* + * Gets or sets the custom message properties. + */ + @JsonProperty(value = "customMessageProperties") + private Map customMessageProperties; + + /* + * Gets or sets the message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Gets or sets the namespace. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /* + * Gets or sets the transport type. + */ + @JsonProperty(value = "transportType") + private ServiceBusTransportType transportType; + + /** + * Get the authentication property: Gets or sets the Service Bus authentication. + * + * @return the authentication value. + */ + public ServiceBusAuthentication authentication() { + return this.authentication; + } + + /** + * Set the authentication property: Gets or sets the Service Bus authentication. + * + * @param authentication the authentication value to set. + * @return the ServiceBusMessage object itself. + */ + public ServiceBusMessage withAuthentication(ServiceBusAuthentication authentication) { + this.authentication = authentication; + return this; + } + + /** + * Get the brokeredMessageProperties property: Gets or sets the brokered message properties. + * + * @return the brokeredMessageProperties value. + */ + public ServiceBusBrokeredMessageProperties brokeredMessageProperties() { + return this.brokeredMessageProperties; + } + + /** + * Set the brokeredMessageProperties property: Gets or sets the brokered message properties. + * + * @param brokeredMessageProperties the brokeredMessageProperties value to set. + * @return the ServiceBusMessage object itself. + */ + public ServiceBusMessage withBrokeredMessageProperties( + ServiceBusBrokeredMessageProperties brokeredMessageProperties) { + this.brokeredMessageProperties = brokeredMessageProperties; + return this; + } + + /** + * Get the customMessageProperties property: Gets or sets the custom message properties. + * + * @return the customMessageProperties value. + */ + public Map customMessageProperties() { + return this.customMessageProperties; + } + + /** + * Set the customMessageProperties property: Gets or sets the custom message properties. + * + * @param customMessageProperties the customMessageProperties value to set. + * @return the ServiceBusMessage object itself. + */ + public ServiceBusMessage withCustomMessageProperties(Map customMessageProperties) { + this.customMessageProperties = customMessageProperties; + return this; + } + + /** + * Get the message property: Gets or sets the message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Gets or sets the message. + * + * @param message the message value to set. + * @return the ServiceBusMessage object itself. + */ + public ServiceBusMessage withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the namespace property: Gets or sets the namespace. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: Gets or sets the namespace. + * + * @param namespace the namespace value to set. + * @return the ServiceBusMessage object itself. + */ + public ServiceBusMessage withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the transportType property: Gets or sets the transport type. + * + * @return the transportType value. + */ + public ServiceBusTransportType transportType() { + return this.transportType; + } + + /** + * Set the transportType property: Gets or sets the transport type. + * + * @param transportType the transportType value to set. + * @return the ServiceBusMessage object itself. + */ + public ServiceBusMessage withTransportType(ServiceBusTransportType transportType) { + this.transportType = transportType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authentication() != null) { + authentication().validate(); + } + if (brokeredMessageProperties() != null) { + brokeredMessageProperties().validate(); + } + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusQueueMessage.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusQueueMessage.java new file mode 100644 index 000000000000..25a8528cdee0 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusQueueMessage.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The ServiceBusQueueMessage model. */ +@Fluent +public final class ServiceBusQueueMessage extends ServiceBusMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceBusQueueMessage.class); + + /* + * Gets or sets the queue name. + */ + @JsonProperty(value = "queueName") + private String queueName; + + /** + * Get the queueName property: Gets or sets the queue name. + * + * @return the queueName value. + */ + public String queueName() { + return this.queueName; + } + + /** + * Set the queueName property: Gets or sets the queue name. + * + * @param queueName the queueName value to set. + * @return the ServiceBusQueueMessage object itself. + */ + public ServiceBusQueueMessage withQueueName(String queueName) { + this.queueName = queueName; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusQueueMessage withAuthentication(ServiceBusAuthentication authentication) { + super.withAuthentication(authentication); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusQueueMessage withBrokeredMessageProperties( + ServiceBusBrokeredMessageProperties brokeredMessageProperties) { + super.withBrokeredMessageProperties(brokeredMessageProperties); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusQueueMessage withCustomMessageProperties(Map customMessageProperties) { + super.withCustomMessageProperties(customMessageProperties); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusQueueMessage withMessage(String message) { + super.withMessage(message); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusQueueMessage withNamespace(String namespace) { + super.withNamespace(namespace); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusQueueMessage withTransportType(ServiceBusTransportType transportType) { + super.withTransportType(transportType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusTopicMessage.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusTopicMessage.java new file mode 100644 index 000000000000..053ff78fd112 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusTopicMessage.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The ServiceBusTopicMessage model. */ +@Fluent +public final class ServiceBusTopicMessage extends ServiceBusMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServiceBusTopicMessage.class); + + /* + * Gets or sets the topic path. + */ + @JsonProperty(value = "topicPath") + private String topicPath; + + /** + * Get the topicPath property: Gets or sets the topic path. + * + * @return the topicPath value. + */ + public String topicPath() { + return this.topicPath; + } + + /** + * Set the topicPath property: Gets or sets the topic path. + * + * @param topicPath the topicPath value to set. + * @return the ServiceBusTopicMessage object itself. + */ + public ServiceBusTopicMessage withTopicPath(String topicPath) { + this.topicPath = topicPath; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusTopicMessage withAuthentication(ServiceBusAuthentication authentication) { + super.withAuthentication(authentication); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusTopicMessage withBrokeredMessageProperties( + ServiceBusBrokeredMessageProperties brokeredMessageProperties) { + super.withBrokeredMessageProperties(brokeredMessageProperties); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusTopicMessage withCustomMessageProperties(Map customMessageProperties) { + super.withCustomMessageProperties(customMessageProperties); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusTopicMessage withMessage(String message) { + super.withMessage(message); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusTopicMessage withNamespace(String namespace) { + super.withNamespace(namespace); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServiceBusTopicMessage withTransportType(ServiceBusTransportType transportType) { + super.withTransportType(transportType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusTransportType.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusTransportType.java new file mode 100644 index 000000000000..7de7237aecbf --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/ServiceBusTransportType.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ServiceBusTransportType. */ +public enum ServiceBusTransportType { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value NetMessaging. */ + NET_MESSAGING("NetMessaging"), + + /** Enum value AMQP. */ + AMQP("AMQP"); + + /** The actual serialized value for a ServiceBusTransportType instance. */ + private final String value; + + ServiceBusTransportType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServiceBusTransportType instance. + * + * @param value the serialized value to parse. + * @return the parsed ServiceBusTransportType object, or null if unable to parse. + */ + @JsonCreator + public static ServiceBusTransportType fromString(String value) { + ServiceBusTransportType[] items = ServiceBusTransportType.values(); + for (ServiceBusTransportType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/Sku.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/Sku.java new file mode 100644 index 000000000000..3efe8308f724 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/Sku.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Sku model. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * Gets or set the SKU. + */ + @JsonProperty(value = "name") + private SkuDefinition name; + + /** + * Get the name property: Gets or set the SKU. + * + * @return the name value. + */ + public SkuDefinition name() { + return this.name; + } + + /** + * Set the name property: Gets or set the SKU. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(SkuDefinition name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/SkuDefinition.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/SkuDefinition.java new file mode 100644 index 000000000000..dae6a693c7b9 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/SkuDefinition.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SkuDefinition. */ +public enum SkuDefinition { + /** Enum value Standard. */ + STANDARD("Standard"), + + /** Enum value Free. */ + FREE("Free"), + + /** Enum value P10Premium. */ + P10PREMIUM("P10Premium"), + + /** Enum value P20Premium. */ + P20PREMIUM("P20Premium"); + + /** The actual serialized value for a SkuDefinition instance. */ + private final String value; + + SkuDefinition(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SkuDefinition instance. + * + * @param value the serialized value to parse. + * @return the parsed SkuDefinition object, or null if unable to parse. + */ + @JsonCreator + public static SkuDefinition fromString(String value) { + SkuDefinition[] items = SkuDefinition.values(); + for (SkuDefinition item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/StorageQueueMessage.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/StorageQueueMessage.java new file mode 100644 index 000000000000..c8e692bbefcf --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/StorageQueueMessage.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.scheduler.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The StorageQueueMessage model. */ +@Fluent +public final class StorageQueueMessage { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageQueueMessage.class); + + /* + * Gets or sets the storage account name. + */ + @JsonProperty(value = "storageAccount") + private String storageAccount; + + /* + * Gets or sets the queue name. + */ + @JsonProperty(value = "queueName") + private String queueName; + + /* + * Gets or sets the SAS key. + */ + @JsonProperty(value = "sasToken") + private String sasToken; + + /* + * Gets or sets the message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the storageAccount property: Gets or sets the storage account name. + * + * @return the storageAccount value. + */ + public String storageAccount() { + return this.storageAccount; + } + + /** + * Set the storageAccount property: Gets or sets the storage account name. + * + * @param storageAccount the storageAccount value to set. + * @return the StorageQueueMessage object itself. + */ + public StorageQueueMessage withStorageAccount(String storageAccount) { + this.storageAccount = storageAccount; + return this; + } + + /** + * Get the queueName property: Gets or sets the queue name. + * + * @return the queueName value. + */ + public String queueName() { + return this.queueName; + } + + /** + * Set the queueName property: Gets or sets the queue name. + * + * @param queueName the queueName value to set. + * @return the StorageQueueMessage object itself. + */ + public StorageQueueMessage withQueueName(String queueName) { + this.queueName = queueName; + return this; + } + + /** + * Get the sasToken property: Gets or sets the SAS key. + * + * @return the sasToken value. + */ + public String sasToken() { + return this.sasToken; + } + + /** + * Set the sasToken property: Gets or sets the SAS key. + * + * @param sasToken the sasToken value to set. + * @return the StorageQueueMessage object itself. + */ + public StorageQueueMessage withSasToken(String sasToken) { + this.sasToken = sasToken; + return this; + } + + /** + * Get the message property: Gets or sets the message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Gets or sets the message. + * + * @param message the message value to set. + * @return the StorageQueueMessage object itself. + */ + public StorageQueueMessage withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/package-info.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/package-info.java new file mode 100644 index 000000000000..2c9cdbc9ac0f --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for SchedulerManagementClient. null. */ +package com.azure.resourcemanager.scheduler.models; diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/package-info.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/package-info.java new file mode 100644 index 000000000000..8d1737795a1b --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/com/azure/resourcemanager/scheduler/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for SchedulerManagementClient. null. */ +package com.azure.resourcemanager.scheduler; diff --git a/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/module-info.java b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/module-info.java new file mode 100644 index 000000000000..461116debfb0 --- /dev/null +++ b/sdk/scheduler/azure-resourcemanager-scheduler/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.scheduler { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.scheduler; + exports com.azure.resourcemanager.scheduler.fluent; + exports com.azure.resourcemanager.scheduler.fluent.models; + exports com.azure.resourcemanager.scheduler.models; + + opens com.azure.resourcemanager.scheduler.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.scheduler.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/scheduler/ci.yml b/sdk/scheduler/ci.yml new file mode 100644 index 000000000000..e6c35d706613 --- /dev/null +++ b/sdk/scheduler/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/scheduler/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/scheduler/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: scheduler + Artifacts: + - name: azure-resourcemanager-scheduler + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerscheduler diff --git a/sdk/scheduler/pom.xml b/sdk/scheduler/pom.xml new file mode 100644 index 000000000000..bd042ac9ee6f --- /dev/null +++ b/sdk/scheduler/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-scheduler-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-scheduler + + + +