diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 2d5512f44ead..6792dfbd5e25 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -431,6 +431,7 @@ com.azure.resourcemanager:azure-resourcemanager-hdinsight-containers;1.0.0-beta. com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-edgemarketplace;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 diff --git a/pom.xml b/pom.xml index 2933b7b5264a..ff9becd82d0c 100644 --- a/pom.xml +++ b/pom.xml @@ -77,6 +77,7 @@ sdk/digitaltwins sdk/dnsresolver sdk/dynatrace + sdk/edgemarketplace sdk/edgeorder sdk/education sdk/elastic diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/CHANGELOG.md b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/CHANGELOG.md new file mode 100644 index 000000000000..636a7598353a --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-10-19) + +- Azure Resource Manager EdgeMarketplace client library for Java. This package contains Microsoft Azure SDK for EdgeMarketplace Management SDK. Edge marketplace extensions. Package tag package-2023-08-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/README.md b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/README.md new file mode 100644 index 000000000000..193a0f6b0ecc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/README.md @@ -0,0 +1,107 @@ +# Azure Resource Manager EdgeMarketplace client library for Java + +Azure Resource Manager EdgeMarketplace client library for Java. + +This package contains Microsoft Azure SDK for EdgeMarketplace Management SDK. Edge marketplace extensions. Package tag package-2023-08-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-edgemarketplace;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-edgemarketplace + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Microsoft Entra ID token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +EdgeMarketplaceManager manager = EdgeMarketplaceManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fedgemarketplace%2Fazure-resourcemanager-edgemarketplace%2FREADME.png) diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md new file mode 100644 index 000000000000..84cd7aeb6cc6 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md @@ -0,0 +1,245 @@ +# Code snippets and samples + + +## Offers + +- [GenerateAccessToken](#offers_generateaccesstoken) +- [Get](#offers_get) +- [GetAccessToken](#offers_getaccesstoken) +- [List](#offers_list) +- [ListBySubscription](#offers_listbysubscription) + +## Operations + +- [List](#operations_list) + +## Publishers + +- [Get](#publishers_get) +- [List](#publishers_list) +- [ListBySubscription](#publishers_listbysubscription) +### Offers_GenerateAccessToken + +```java +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; + +/** Samples for Offers GenerateAccessToken. */ +public final class OffersGenerateAccessTokenSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GenerateAccessToken.json + */ + /** + * Sample code: Generate AccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void generateAccessToken(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .generateAccessToken( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "0001-com-ubuntu-pro-jammy", + new AccessTokenRequest() + .withPublisherName("ubuntu") + .withEdgeMarketPlaceRegion("EastUS2Euap") + .withEgeMarketPlaceResourceId("testid") + .withHypervGeneration("V2") + .withMarketPlaceSku("2022-datacenter-azure-edition-core") + .withMarketPlaceSkuVersion("20348.1129.221007") + .withDeviceSku("edge") + .withDeviceVersion("1.0.18062.1"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Offers_Get + +```java +/** Samples for Offers Get. */ +public final class OffersGetSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GetOffer.json + */ + /** + * Sample code: Get offer. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void getOffer(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .getWithResponse( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "0001-com-ubuntu-pro-jammy", + com.azure.core.util.Context.NONE); + } +} +``` + +### Offers_GetAccessToken + +```java +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; + +/** Samples for Offers GetAccessToken. */ +public final class OffersGetAccessTokenSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GetAccessToken.json + */ + /** + * Sample code: Get AccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void getAccessToken(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .getAccessTokenWithResponse( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "0001-com-ubuntu-pro-jammy", + new AccessTokenReadRequest().withRequestId("1.0.18062.1"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Offers_List + +```java +/** Samples for Offers List. */ +public final class OffersListSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListOffers.json + */ + /** + * Sample code: List offers. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listOffers(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .list( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + null, + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Offers_ListBySubscription + +```java +/** Samples for Offers ListBySubscription. */ +public final class OffersListBySubscriptionSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListOffersBySubscription.json + */ + /** + * Sample code: List offers by subscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listOffersBySubscription( + com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.offers().listBySubscription(null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListOperations.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listOperations(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Publishers_Get + +```java +/** Samples for Publishers Get. */ +public final class PublishersGetSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GetPublisher.json + */ + /** + * Sample code: Get publisher. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void getPublisher(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .publishers() + .getWithResponse( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "canonical", + com.azure.core.util.Context.NONE); + } +} +``` + +### Publishers_List + +```java +/** Samples for Publishers List. */ +public final class PublishersListSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListPublishers.json + */ + /** + * Sample code: List publishers. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listPublishers(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .publishers() + .list( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + null, + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### Publishers_ListBySubscription + +```java +/** Samples for Publishers ListBySubscription. */ +public final class PublishersListBySubscriptionSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListPublishersBySubscription.json + */ + /** + * Sample code: List publishers by subscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listPublishersBySubscription( + com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.publishers().listBySubscription(null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/pom.xml b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/pom.xml new file mode 100644 index 000000000000..60eadd3156ff --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-edgemarketplace + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for EdgeMarketplace Management + This package contains Microsoft Azure SDK for EdgeMarketplace Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Edge marketplace extensions. Package tag package-2023-08-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.44.1 + + + com.azure + azure-core-management + 1.11.7 + + + diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/EdgeMarketplaceManager.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/EdgeMarketplaceManager.java new file mode 100644 index 000000000000..c707a4efa39d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/EdgeMarketplaceManager.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.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.edgemarketplace.fluent.EdgeMarketplaceClient; +import com.azure.resourcemanager.edgemarketplace.implementation.EdgeMarketplaceClientBuilder; +import com.azure.resourcemanager.edgemarketplace.implementation.OffersImpl; +import com.azure.resourcemanager.edgemarketplace.implementation.OperationsImpl; +import com.azure.resourcemanager.edgemarketplace.implementation.PublishersImpl; +import com.azure.resourcemanager.edgemarketplace.models.Offers; +import com.azure.resourcemanager.edgemarketplace.models.Operations; +import com.azure.resourcemanager.edgemarketplace.models.Publishers; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to EdgeMarketplaceManager. Edge marketplace extensions. */ +public final class EdgeMarketplaceManager { + private Publishers publishers; + + private Operations operations; + + private Offers offers; + + private final EdgeMarketplaceClient clientObject; + + private EdgeMarketplaceManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new EdgeMarketplaceClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of EdgeMarketplace service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the EdgeMarketplace service API instance. + */ + public static EdgeMarketplaceManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of EdgeMarketplace service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the EdgeMarketplace service API instance. + */ + public static EdgeMarketplaceManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new EdgeMarketplaceManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create EdgeMarketplaceManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new EdgeMarketplaceManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static 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 RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of EdgeMarketplace service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the EdgeMarketplace service API instance. + */ + public EdgeMarketplaceManager 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.edgemarketplace") + .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) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new EdgeMarketplaceManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Publishers. + * + * @return Resource collection API of Publishers. + */ + public Publishers publishers() { + if (this.publishers == null) { + this.publishers = new PublishersImpl(clientObject.getPublishers(), this); + } + return publishers; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Offers. + * + * @return Resource collection API of Offers. + */ + public Offers offers() { + if (this.offers == null) { + this.offers = new OffersImpl(clientObject.getOffers(), this); + } + return offers; + } + + /** + * Gets wrapped service client EdgeMarketplaceClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client EdgeMarketplaceClient. + */ + public EdgeMarketplaceClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceClient.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceClient.java new file mode 100644 index 000000000000..21941c61666e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceClient.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for EdgeMarketplaceClient class. */ +public interface EdgeMarketplaceClient { + /** + * Gets The ID of the target subscription. + * + * @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 PublishersClient object to access its operations. + * + * @return the PublishersClient object. + */ + PublishersClient getPublishers(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the OffersClient object to access its operations. + * + * @return the OffersClient object. + */ + OffersClient getOffers(); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OffersClient.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OffersClient.java new file mode 100644 index 000000000000..d06af23c57d0 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OffersClient.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.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.edgemarketplace.fluent.models.DiskAccessTokenInner; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; + +/** An instance of this class provides access to all the operations defined in OffersClient. */ +public interface OffersClient { + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context); + + /** + * List Offer resources by 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 the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context); + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @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 Offer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String offerId, Context context); + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @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 Offer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OfferInner get(String resourceUri, String offerId); + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the disk access token. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskAccessTokenInner> beginGenerateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body); + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the disk access token. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiskAccessTokenInner> beginGenerateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body, Context context); + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessTokenInner generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body); + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessTokenInner generateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body, Context context); + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 access token along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAccessTokenWithResponse( + String resourceUri, String offerId, AccessTokenReadRequest body, Context context); + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiskAccessTokenInner getAccessToken(String resourceUri, String offerId, AccessTokenReadRequest body); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OperationsClient.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OperationsClient.java new file mode 100644 index 000000000000..8f7317787c46 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/PublishersClient.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/PublishersClient.java new file mode 100644 index 000000000000..3462ffb6827d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/PublishersClient.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.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.edgemarketplace.fluent.models.PublisherInner; + +/** An instance of this class provides access to all the operations defined in PublishersClient. */ +public interface PublishersClient { + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context); + + /** + * List Publisher resources in 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 the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(); + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context); + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @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 Publisher along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String publisherName, Context context); + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @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 Publisher. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PublisherInner get(String resourceUri, String publisherName); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/DiskAccessTokenInner.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/DiskAccessTokenInner.java new file mode 100644 index 000000000000..cf0af6a578e8 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/DiskAccessTokenInner.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The disk access token. */ +@Fluent +public final class DiskAccessTokenInner { + /* + * The disk id. + */ + @JsonProperty(value = "diskId") + private String diskId; + + /* + * The access token creation status. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The access token. + */ + @JsonProperty(value = "accessToken", required = true) + private String accessToken; + + /** Creates an instance of DiskAccessTokenInner class. */ + public DiskAccessTokenInner() { + } + + /** + * Get the diskId property: The disk id. + * + * @return the diskId value. + */ + public String diskId() { + return this.diskId; + } + + /** + * Set the diskId property: The disk id. + * + * @param diskId the diskId value to set. + * @return the DiskAccessTokenInner object itself. + */ + public DiskAccessTokenInner withDiskId(String diskId) { + this.diskId = diskId; + return this; + } + + /** + * Get the status property: The access token creation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The access token creation status. + * + * @param status the status value to set. + * @return the DiskAccessTokenInner object itself. + */ + public DiskAccessTokenInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the accessToken property: The access token. + * + * @return the accessToken value. + */ + public String accessToken() { + return this.accessToken; + } + + /** + * Set the accessToken property: The access token. + * + * @param accessToken the accessToken value to set. + * @return the DiskAccessTokenInner object itself. + */ + public DiskAccessTokenInner withAccessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accessToken() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accessToken in model DiskAccessTokenInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiskAccessTokenInner.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferInner.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferInner.java new file mode 100644 index 000000000000..712545d1179e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferInner.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku; +import com.azure.resourcemanager.edgemarketplace.models.OfferContent; +import com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An offer. */ +@Fluent +public final class OfferInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private OfferProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of OfferInner class. */ + public OfferInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private OfferProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the contentVersion property: The content version. + * + * @return the contentVersion value. + */ + public String contentVersion() { + return this.innerProperties() == null ? null : this.innerProperties().contentVersion(); + } + + /** + * Set the contentVersion property: The content version. + * + * @param contentVersion the contentVersion value to set. + * @return the OfferInner object itself. + */ + public OfferInner withContentVersion(String contentVersion) { + if (this.innerProperties() == null) { + this.innerProperties = new OfferProperties(); + } + this.innerProperties().withContentVersion(contentVersion); + return this; + } + + /** + * Get the contentUrl property: The content url. + * + * @return the contentUrl value. + */ + public String contentUrl() { + return this.innerProperties() == null ? null : this.innerProperties().contentUrl(); + } + + /** + * Set the contentUrl property: The content url. + * + * @param contentUrl the contentUrl value to set. + * @return the OfferInner object itself. + */ + public OfferInner withContentUrl(String contentUrl) { + if (this.innerProperties() == null) { + this.innerProperties = new OfferProperties(); + } + this.innerProperties().withContentUrl(contentUrl); + return this; + } + + /** + * Get the offerContent property: The offer content. + * + * @return the offerContent value. + */ + public OfferContent offerContent() { + return this.innerProperties() == null ? null : this.innerProperties().offerContent(); + } + + /** + * Set the offerContent property: The offer content. + * + * @param offerContent the offerContent value to set. + * @return the OfferInner object itself. + */ + public OfferInner withOfferContent(OfferContent offerContent) { + if (this.innerProperties() == null) { + this.innerProperties = new OfferProperties(); + } + this.innerProperties().withOfferContent(offerContent); + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: The resource provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the OfferInner object itself. + */ + public OfferInner withProvisioningState(ResourceProvisioningState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new OfferProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the marketplaceSkus property: The marketplace skus. + * + * @return the marketplaceSkus value. + */ + public List marketplaceSkus() { + return this.innerProperties() == null ? null : this.innerProperties().marketplaceSkus(); + } + + /** + * Set the marketplaceSkus property: The marketplace skus. + * + * @param marketplaceSkus the marketplaceSkus value to set. + * @return the OfferInner object itself. + */ + public OfferInner withMarketplaceSkus(List marketplaceSkus) { + if (this.innerProperties() == null) { + this.innerProperties = new OfferProperties(); + } + this.innerProperties().withMarketplaceSkus(marketplaceSkus); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferProperties.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferProperties.java new file mode 100644 index 000000000000..c6ffeabc86eb --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferProperties.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku; +import com.azure.resourcemanager.edgemarketplace.models.OfferContent; +import com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The offer properties. */ +@Fluent +public final class OfferProperties { + /* + * The content version + */ + @JsonProperty(value = "contentVersion") + private String contentVersion; + + /* + * The content url + */ + @JsonProperty(value = "contentUrl") + private String contentUrl; + + /* + * The offer content + */ + @JsonProperty(value = "offerContent", required = true) + private OfferContent offerContent; + + /* + * The resource provisioning state + */ + @JsonProperty(value = "provisioningState") + private ResourceProvisioningState provisioningState; + + /* + * The marketplace skus + */ + @JsonProperty(value = "marketplaceSkus") + private List marketplaceSkus; + + /** Creates an instance of OfferProperties class. */ + public OfferProperties() { + } + + /** + * Get the contentVersion property: The content version. + * + * @return the contentVersion value. + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Set the contentVersion property: The content version. + * + * @param contentVersion the contentVersion value to set. + * @return the OfferProperties object itself. + */ + public OfferProperties withContentVersion(String contentVersion) { + this.contentVersion = contentVersion; + return this; + } + + /** + * Get the contentUrl property: The content url. + * + * @return the contentUrl value. + */ + public String contentUrl() { + return this.contentUrl; + } + + /** + * Set the contentUrl property: The content url. + * + * @param contentUrl the contentUrl value to set. + * @return the OfferProperties object itself. + */ + public OfferProperties withContentUrl(String contentUrl) { + this.contentUrl = contentUrl; + return this; + } + + /** + * Get the offerContent property: The offer content. + * + * @return the offerContent value. + */ + public OfferContent offerContent() { + return this.offerContent; + } + + /** + * Set the offerContent property: The offer content. + * + * @param offerContent the offerContent value to set. + * @return the OfferProperties object itself. + */ + public OfferProperties withOfferContent(OfferContent offerContent) { + this.offerContent = offerContent; + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The resource provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the OfferProperties object itself. + */ + public OfferProperties withProvisioningState(ResourceProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the marketplaceSkus property: The marketplace skus. + * + * @return the marketplaceSkus value. + */ + public List marketplaceSkus() { + return this.marketplaceSkus; + } + + /** + * Set the marketplaceSkus property: The marketplace skus. + * + * @param marketplaceSkus the marketplaceSkus value to set. + * @return the OfferProperties object itself. + */ + public OfferProperties withMarketplaceSkus(List marketplaceSkus) { + this.marketplaceSkus = marketplaceSkus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (offerContent() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property offerContent in model OfferProperties")); + } else { + offerContent().validate(); + } + if (marketplaceSkus() != null) { + marketplaceSkus().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfferProperties.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OperationInner.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OperationInner.java new file mode 100644 index 000000000000..1825066a64b1 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.edgemarketplace.models.ActionType; +import com.azure.resourcemanager.edgemarketplace.models.OperationDisplay; +import com.azure.resourcemanager.edgemarketplace.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherInner.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherInner.java new file mode 100644 index 000000000000..3a2305a5c8be --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A publisher who provides offers. */ +@Fluent +public final class PublisherInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private PublisherProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of PublisherInner class. */ + public PublisherInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private PublisherProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: The resource provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the PublisherInner object itself. + */ + public PublisherInner withProvisioningState(ResourceProvisioningState provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new PublisherProperties(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherProperties.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherProperties.java new file mode 100644 index 000000000000..68aa8e6ebfe4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherProperties.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.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Publisher properties. */ +@Fluent +public final class PublisherProperties { + /* + * The resource provisioning state + */ + @JsonProperty(value = "provisioningState", required = true) + private ResourceProvisioningState provisioningState; + + /** Creates an instance of PublisherProperties class. */ + public PublisherProperties() { + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: The resource provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the PublisherProperties object itself. + */ + public PublisherProperties withProvisioningState(ResourceProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (provisioningState() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property provisioningState in model PublisherProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PublisherProperties.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/package-info.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/package-info.java new file mode 100644 index 000000000000..81344b7d2f8b --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/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 EdgeMarketplaceClient. Edge marketplace extensions. */ +package com.azure.resourcemanager.edgemarketplace.fluent.models; diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/package-info.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/package-info.java new file mode 100644 index 000000000000..d7d63ea1141a --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/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 EdgeMarketplaceClient. Edge marketplace extensions. */ +package com.azure.resourcemanager.edgemarketplace.fluent; diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/DiskAccessTokenImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/DiskAccessTokenImpl.java new file mode 100644 index 000000000000..5ccde0723c96 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/DiskAccessTokenImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner; +import com.azure.resourcemanager.edgemarketplace.models.DiskAccessToken; + +public final class DiskAccessTokenImpl implements DiskAccessToken { + private DiskAccessTokenInner innerObject; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + DiskAccessTokenImpl( + DiskAccessTokenInner innerObject, + com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String diskId() { + return this.innerModel().diskId(); + } + + public String status() { + return this.innerModel().status(); + } + + public String accessToken() { + return this.innerModel().accessToken(); + } + + public DiskAccessTokenInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceClientBuilder.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceClientBuilder.java new file mode 100644 index 000000000000..bfbc8f9dd0d2 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the EdgeMarketplaceClientImpl type. */ +@ServiceClientBuilder(serviceClients = {EdgeMarketplaceClientImpl.class}) +public final class EdgeMarketplaceClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the EdgeMarketplaceClientBuilder. + */ + public EdgeMarketplaceClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the EdgeMarketplaceClientBuilder. + */ + public EdgeMarketplaceClientBuilder 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 EdgeMarketplaceClientBuilder. + */ + public EdgeMarketplaceClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the EdgeMarketplaceClientBuilder. + */ + public EdgeMarketplaceClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the EdgeMarketplaceClientBuilder. + */ + public EdgeMarketplaceClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the EdgeMarketplaceClientBuilder. + */ + public EdgeMarketplaceClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of EdgeMarketplaceClientImpl with the provided parameters. + * + * @return an instance of EdgeMarketplaceClientImpl. + */ + public EdgeMarketplaceClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + EdgeMarketplaceClientImpl client = + new EdgeMarketplaceClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + this.subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceClientImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceClientImpl.java new file mode 100644 index 000000000000..d70a3a7fafea --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceClientImpl.java @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.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.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.edgemarketplace.fluent.EdgeMarketplaceClient; +import com.azure.resourcemanager.edgemarketplace.fluent.OffersClient; +import com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient; +import com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the EdgeMarketplaceClientImpl type. */ +@ServiceClient(builder = EdgeMarketplaceClientBuilder.class) +public final class EdgeMarketplaceClientImpl implements EdgeMarketplaceClient { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @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 PublishersClient object to access its operations. */ + private final PublishersClient publishers; + + /** + * Gets the PublishersClient object to access its operations. + * + * @return the PublishersClient object. + */ + public PublishersClient getPublishers() { + return this.publishers; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The OffersClient object to access its operations. */ + private final OffersClient offers; + + /** + * Gets the OffersClient object to access its operations. + * + * @return the OffersClient object. + */ + public OffersClient getOffers() { + return this.offers; + } + + /** + * Initializes an instance of EdgeMarketplaceClient 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 ID of the target subscription. + * @param endpoint server parameter. + */ + EdgeMarketplaceClientImpl( + 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 = "2023-08-01-preview"; + this.publishers = new PublishersClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.offers = new OffersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets 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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EdgeMarketplaceClientImpl.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OfferImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OfferImpl.java new file mode 100644 index 000000000000..647afd32a889 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OfferImpl.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku; +import com.azure.resourcemanager.edgemarketplace.models.Offer; +import com.azure.resourcemanager.edgemarketplace.models.OfferContent; +import com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState; +import java.util.Collections; +import java.util.List; + +public final class OfferImpl implements Offer { + private OfferInner innerObject; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + OfferImpl(OfferInner innerObject, com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String contentVersion() { + return this.innerModel().contentVersion(); + } + + public String contentUrl() { + return this.innerModel().contentUrl(); + } + + public OfferContent offerContent() { + return this.innerModel().offerContent(); + } + + public ResourceProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public List marketplaceSkus() { + List inner = this.innerModel().marketplaceSkus(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OfferInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersClientImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersClientImpl.java new file mode 100644 index 000000000000..6d94d7e157ae --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersClientImpl.java @@ -0,0 +1,1249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.edgemarketplace.fluent.OffersClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; +import com.azure.resourcemanager.edgemarketplace.models.OfferListResult; +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 OffersClient. */ +public final class OffersClientImpl implements OffersClient { + /** The proxy service used to perform REST calls. */ + private final OffersService service; + + /** The service client containing this operation class. */ + private final EdgeMarketplaceClientImpl client; + + /** + * Initializes an instance of OffersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OffersClientImpl(EdgeMarketplaceClientImpl client) { + this.service = RestProxy.create(OffersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeMarketplaceClientOffers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "EdgeMarketplaceClien") + public interface OffersService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("$top") Integer top, + @QueryParam("skip") Integer skip, + @QueryParam("maxpagesize") Integer maxPageSize, + @QueryParam("$filter") String filter, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/offers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @QueryParam("skip") Integer skip, + @QueryParam("maxpagesize") Integer maxPageSize, + @QueryParam("$filter") String filter, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("offerId") String offerId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> generateAccessToken( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("offerId") String offerId, + @BodyParam("application/json") AccessTokenRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/getAccessToken") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAccessToken( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("offerId") String offerId, + @BodyParam("application/json") AccessTokenReadRequest body, + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + top, + skip, + maxPageSize, + filter, + skipToken, + 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())); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + top, + skip, + maxPageSize, + filter, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Offer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, top, skip, maxPageSize, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, top, skip, maxPageSize, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, top, skip, maxPageSize, filter, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceUri, top, skip, maxPageSize, filter, skipToken)); + } + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + return new PagedIterable<>(listAsync(resourceUri, top, skip, maxPageSize, filter, skipToken, context)); + } + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + top, + skip, + maxPageSize, + filter, + skipToken, + 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())); + } + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + top, + skip, + maxPageSize, + filter, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Offer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(top, skip, maxPageSize, filter, skipToken), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Offer resources by 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 the response of a Offer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(top, skip, maxPageSize, filter, skipToken), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(top, skip, maxPageSize, filter, skipToken, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Offer resources by 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 the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listBySubscriptionAsync(top, skip, maxPageSize, filter, skipToken)); + } + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + return new PagedIterable<>(listBySubscriptionAsync(top, skip, maxPageSize, filter, skipToken, context)); + } + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Offer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String offerId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (offerId == null) { + return Mono.error(new IllegalArgumentException("Parameter offerId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + offerId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @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 Offer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String offerId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (offerId == null) { + return Mono.error(new IllegalArgumentException("Parameter offerId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, offerId, accept, context); + } + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Offer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String offerId) { + return getWithResponseAsync(resourceUri, offerId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @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 Offer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String offerId, Context context) { + return getWithResponseAsync(resourceUri, offerId, context).block(); + } + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Offer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OfferInner get(String resourceUri, String offerId) { + return getWithResponse(resourceUri, offerId, Context.NONE).getValue(); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the disk access token along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> generateAccessTokenWithResponseAsync( + String resourceUri, String offerId, AccessTokenRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (offerId == null) { + return Mono.error(new IllegalArgumentException("Parameter offerId is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .generateAccessToken( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + offerId, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> generateAccessTokenWithResponseAsync( + String resourceUri, String offerId, AccessTokenRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (offerId == null) { + return Mono.error(new IllegalArgumentException("Parameter offerId is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .generateAccessToken( + this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, offerId, body, accept, context); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the disk access token. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskAccessTokenInner> beginGenerateAccessTokenAsync( + String resourceUri, String offerId, AccessTokenRequest body) { + Mono>> mono = generateAccessTokenWithResponseAsync(resourceUri, offerId, body); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + DiskAccessTokenInner.class, + DiskAccessTokenInner.class, + this.client.getContext()); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the disk access token. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiskAccessTokenInner> beginGenerateAccessTokenAsync( + String resourceUri, String offerId, AccessTokenRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + generateAccessTokenWithResponseAsync(resourceUri, offerId, body, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DiskAccessTokenInner.class, DiskAccessTokenInner.class, context); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the disk access token. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessTokenInner> beginGenerateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body) { + return this.beginGenerateAccessTokenAsync(resourceUri, offerId, body).getSyncPoller(); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the disk access token. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessTokenInner> beginGenerateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body, Context context) { + return this.beginGenerateAccessTokenAsync(resourceUri, offerId, body, context).getSyncPoller(); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the disk access token on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateAccessTokenAsync( + String resourceUri, String offerId, AccessTokenRequest body) { + return beginGenerateAccessTokenAsync(resourceUri, offerId, body) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono generateAccessTokenAsync( + String resourceUri, String offerId, AccessTokenRequest body, Context context) { + return beginGenerateAccessTokenAsync(resourceUri, offerId, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the disk access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessTokenInner generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body) { + return generateAccessTokenAsync(resourceUri, offerId, body).block(); + } + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessTokenInner generateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body, Context context) { + return generateAccessTokenAsync(resourceUri, offerId, body, context).block(); + } + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return access token along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAccessTokenWithResponseAsync( + String resourceUri, String offerId, AccessTokenReadRequest body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (offerId == null) { + return Mono.error(new IllegalArgumentException("Parameter offerId is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAccessToken( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + offerId, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 access token along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAccessTokenWithResponseAsync( + String resourceUri, String offerId, AccessTokenReadRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (offerId == null) { + return Mono.error(new IllegalArgumentException("Parameter offerId is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAccessToken( + this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, offerId, body, accept, context); + } + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return access token on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAccessTokenAsync( + String resourceUri, String offerId, AccessTokenReadRequest body) { + return getAccessTokenWithResponseAsync(resourceUri, offerId, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 access token along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAccessTokenWithResponse( + String resourceUri, String offerId, AccessTokenReadRequest body, Context context) { + return getAccessTokenWithResponseAsync(resourceUri, offerId, body, context).block(); + } + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return access token. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessTokenInner getAccessToken(String resourceUri, String offerId, AccessTokenReadRequest body) { + return getAccessTokenWithResponse(resourceUri, offerId, body, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Offer list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersImpl.java new file mode 100644 index 000000000000..09668b29429a --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersImpl.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.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.edgemarketplace.fluent.OffersClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; +import com.azure.resourcemanager.edgemarketplace.models.DiskAccessToken; +import com.azure.resourcemanager.edgemarketplace.models.Offer; +import com.azure.resourcemanager.edgemarketplace.models.Offers; + +public final class OffersImpl implements Offers { + private static final ClientLogger LOGGER = new ClientLogger(OffersImpl.class); + + private final OffersClient innerClient; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + public OffersImpl( + OffersClient innerClient, com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceUri, top, skip, maxPageSize, filter, skipToken, context); + return Utils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return Utils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().listBySubscription(top, skip, maxPageSize, filter, skipToken, context); + return Utils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceUri, String offerId, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, offerId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OfferImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Offer get(String resourceUri, String offerId) { + OfferInner inner = this.serviceClient().get(resourceUri, offerId); + if (inner != null) { + return new OfferImpl(inner, this.manager()); + } else { + return null; + } + } + + public DiskAccessToken generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body) { + DiskAccessTokenInner inner = this.serviceClient().generateAccessToken(resourceUri, offerId, body); + if (inner != null) { + return new DiskAccessTokenImpl(inner, this.manager()); + } else { + return null; + } + } + + public DiskAccessToken generateAccessToken( + String resourceUri, String offerId, AccessTokenRequest body, Context context) { + DiskAccessTokenInner inner = this.serviceClient().generateAccessToken(resourceUri, offerId, body, context); + if (inner != null) { + return new DiskAccessTokenImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAccessTokenWithResponse( + String resourceUri, String offerId, AccessTokenReadRequest body, Context context) { + Response inner = + this.serviceClient().getAccessTokenWithResponse(resourceUri, offerId, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiskAccessTokenImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiskAccessToken getAccessToken(String resourceUri, String offerId, AccessTokenReadRequest body) { + DiskAccessTokenInner inner = this.serviceClient().getAccessToken(resourceUri, offerId, body); + if (inner != null) { + return new DiskAccessTokenImpl(inner, this.manager()); + } else { + return null; + } + } + + private OffersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationImpl.java new file mode 100644 index 000000000000..e56783715344 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; +import com.azure.resourcemanager.edgemarketplace.models.ActionType; +import com.azure.resourcemanager.edgemarketplace.models.Operation; +import com.azure.resourcemanager.edgemarketplace.models.OperationDisplay; +import com.azure.resourcemanager.edgemarketplace.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsClientImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..d781647309e7 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsClientImpl.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.edgemarketplace.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; +import com.azure.resourcemanager.edgemarketplace.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final EdgeMarketplaceClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(EdgeMarketplaceClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeMarketplaceClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "EdgeMarketplaceClien") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.EdgeMarketplace/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsImpl.java new file mode 100644 index 000000000000..35161855e903 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; +import com.azure.resourcemanager.edgemarketplace.models.Operation; +import com.azure.resourcemanager.edgemarketplace.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublisherImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublisherImpl.java new file mode 100644 index 000000000000..0744ab03690a --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublisherImpl.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.edgemarketplace.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; +import com.azure.resourcemanager.edgemarketplace.models.Publisher; +import com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState; + +public final class PublisherImpl implements Publisher { + private PublisherInner innerObject; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + PublisherImpl( + PublisherInner innerObject, com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ResourceProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PublisherInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersClientImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersClientImpl.java new file mode 100644 index 000000000000..4c5aae5a182c --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersClientImpl.java @@ -0,0 +1,835 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; +import com.azure.resourcemanager.edgemarketplace.models.PublisherListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PublishersClient. */ +public final class PublishersClientImpl implements PublishersClient { + /** The proxy service used to perform REST calls. */ + private final PublishersService service; + + /** The service client containing this operation class. */ + private final EdgeMarketplaceClientImpl client; + + /** + * Initializes an instance of PublishersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PublishersClientImpl(EdgeMarketplaceClientImpl client) { + this.service = + RestProxy.create(PublishersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeMarketplaceClientPublishers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "EdgeMarketplaceClien") + public interface PublishersService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("$top") Integer top, + @QueryParam("skip") Integer skip, + @QueryParam("maxpagesize") Integer maxPageSize, + @QueryParam("$filter") String filter, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/publishers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("$top") Integer top, + @QueryParam("skip") Integer skip, + @QueryParam("maxpagesize") Integer maxPageSize, + @QueryParam("$filter") String filter, + @QueryParam("$skipToken") String skipToken, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers/{publisherName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("publisherName") String publisherName, + @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> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + top, + skip, + maxPageSize, + filter, + skipToken, + 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())); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + top, + skip, + maxPageSize, + filter, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Publisher list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, top, skip, maxPageSize, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, top, skip, maxPageSize, filter, skipToken), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceUri, top, skip, maxPageSize, filter, skipToken, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listAsync(resourceUri, top, skip, maxPageSize, filter, skipToken)); + } + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + return new PagedIterable<>(listAsync(resourceUri, top, skip, maxPageSize, filter, skipToken, context)); + } + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listBySubscription( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + top, + skip, + maxPageSize, + filter, + skipToken, + 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())); + } + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionSinglePageAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscription( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + top, + skip, + maxPageSize, + filter, + skipToken, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a Publisher list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(top, skip, maxPageSize, filter, skipToken), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Publisher resources in 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 the response of a Publisher list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync() { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(top, skip, maxPageSize, filter, skipToken), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySubscriptionAsync( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + return new PagedFlux<>( + () -> listBySubscriptionSinglePageAsync(top, skip, maxPageSize, filter, skipToken, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List Publisher resources in 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 the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription() { + final Integer top = null; + final Integer skip = null; + final Integer maxPageSize = null; + final String filter = null; + final String skipToken = null; + return new PagedIterable<>(listBySubscriptionAsync(top, skip, maxPageSize, filter, skipToken)); + } + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + return new PagedIterable<>(listBySubscriptionAsync(top, skip, maxPageSize, filter, skipToken, context)); + } + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Publisher along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String publisherName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + resourceUri, + publisherName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @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 Publisher along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String publisherName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (publisherName == null) { + return Mono.error(new IllegalArgumentException("Parameter publisherName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, publisherName, accept, context); + } + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Publisher on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String publisherName) { + return getWithResponseAsync(resourceUri, publisherName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @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 Publisher along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String publisherName, Context context) { + return getWithResponseAsync(resourceUri, publisherName, context).block(); + } + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Publisher. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PublisherInner get(String resourceUri, String publisherName) { + return getWithResponse(resourceUri, publisherName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

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 of a Publisher list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersImpl.java new file mode 100644 index 000000000000..0668a91f69bc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersImpl.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.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.edgemarketplace.fluent.PublishersClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; +import com.azure.resourcemanager.edgemarketplace.models.Publisher; +import com.azure.resourcemanager.edgemarketplace.models.Publishers; + +public final class PublishersImpl implements Publishers { + private static final ClientLogger LOGGER = new ClientLogger(PublishersImpl.class); + + private final PublishersClient innerClient; + + private final com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager; + + public PublishersImpl( + PublishersClient innerClient, com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceUri, top, skip, maxPageSize, filter, skipToken, context); + return Utils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return Utils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context) { + PagedIterable inner = + this.serviceClient().listBySubscription(top, skip, maxPageSize, filter, skipToken, context); + return Utils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + public Response getWithResponse(String resourceUri, String publisherName, Context context) { + Response inner = this.serviceClient().getWithResponse(resourceUri, publisherName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PublisherImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Publisher get(String resourceUri, String publisherName) { + PublisherInner inner = this.serviceClient().get(resourceUri, publisherName); + if (inner != null) { + return new PublisherImpl(inner, this.manager()); + } else { + return null; + } + } + + private PublishersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/Utils.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/Utils.java new file mode 100644 index 000000000000..04bc1ad52a2d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/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.edgemarketplace.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 { + private 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.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/package-info.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/package-info.java new file mode 100644 index 000000000000..22971b048814 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/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 EdgeMarketplaceClient. Edge marketplace extensions. */ +package com.azure.resourcemanager.edgemarketplace.implementation; diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenReadRequest.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenReadRequest.java new file mode 100644 index 000000000000..846f966ad1c8 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenReadRequest.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Access token request object. */ +@Fluent +public final class AccessTokenReadRequest { + /* + * The name of the publisher. + */ + @JsonProperty(value = "requestId", required = true) + private String requestId; + + /** Creates an instance of AccessTokenReadRequest class. */ + public AccessTokenReadRequest() { + } + + /** + * Get the requestId property: The name of the publisher. + * + * @return the requestId value. + */ + public String requestId() { + return this.requestId; + } + + /** + * Set the requestId property: The name of the publisher. + * + * @param requestId the requestId value to set. + * @return the AccessTokenReadRequest object itself. + */ + public AccessTokenReadRequest withRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requestId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property requestId in model AccessTokenReadRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccessTokenReadRequest.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenRequest.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenRequest.java new file mode 100644 index 000000000000..1b75f7905fe5 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenRequest.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Access token request object. */ +@Fluent +public final class AccessTokenRequest { + /* + * The name of the publisher. + */ + @JsonProperty(value = "publisherName") + private String publisherName; + + /* + * The region where the disk will be created. + */ + @JsonProperty(value = "edgeMarketPlaceRegion", required = true) + private String edgeMarketPlaceRegion; + + /* + * The region where the disk will be created. + */ + @JsonProperty(value = "egeMarketPlaceResourceId") + private String egeMarketPlaceResourceId; + + /* + * The hyperv version. + */ + @JsonProperty(value = "hypervGeneration") + private String hypervGeneration; + + /* + * The marketplace sku. + */ + @JsonProperty(value = "marketPlaceSku") + private String marketPlaceSku; + + /* + * The marketplace sku version. + */ + @JsonProperty(value = "marketPlaceSkuVersion") + private String marketPlaceSkuVersion; + + /* + * The device sku. + */ + @JsonProperty(value = "deviceSku") + private String deviceSku; + + /* + * The device sku version. + */ + @JsonProperty(value = "deviceVersion") + private String deviceVersion; + + /** Creates an instance of AccessTokenRequest class. */ + public AccessTokenRequest() { + } + + /** + * Get the publisherName property: The name of the publisher. + * + * @return the publisherName value. + */ + public String publisherName() { + return this.publisherName; + } + + /** + * Set the publisherName property: The name of the publisher. + * + * @param publisherName the publisherName value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withPublisherName(String publisherName) { + this.publisherName = publisherName; + return this; + } + + /** + * Get the edgeMarketPlaceRegion property: The region where the disk will be created. + * + * @return the edgeMarketPlaceRegion value. + */ + public String edgeMarketPlaceRegion() { + return this.edgeMarketPlaceRegion; + } + + /** + * Set the edgeMarketPlaceRegion property: The region where the disk will be created. + * + * @param edgeMarketPlaceRegion the edgeMarketPlaceRegion value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withEdgeMarketPlaceRegion(String edgeMarketPlaceRegion) { + this.edgeMarketPlaceRegion = edgeMarketPlaceRegion; + return this; + } + + /** + * Get the egeMarketPlaceResourceId property: The region where the disk will be created. + * + * @return the egeMarketPlaceResourceId value. + */ + public String egeMarketPlaceResourceId() { + return this.egeMarketPlaceResourceId; + } + + /** + * Set the egeMarketPlaceResourceId property: The region where the disk will be created. + * + * @param egeMarketPlaceResourceId the egeMarketPlaceResourceId value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withEgeMarketPlaceResourceId(String egeMarketPlaceResourceId) { + this.egeMarketPlaceResourceId = egeMarketPlaceResourceId; + return this; + } + + /** + * Get the hypervGeneration property: The hyperv version. + * + * @return the hypervGeneration value. + */ + public String hypervGeneration() { + return this.hypervGeneration; + } + + /** + * Set the hypervGeneration property: The hyperv version. + * + * @param hypervGeneration the hypervGeneration value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withHypervGeneration(String hypervGeneration) { + this.hypervGeneration = hypervGeneration; + return this; + } + + /** + * Get the marketPlaceSku property: The marketplace sku. + * + * @return the marketPlaceSku value. + */ + public String marketPlaceSku() { + return this.marketPlaceSku; + } + + /** + * Set the marketPlaceSku property: The marketplace sku. + * + * @param marketPlaceSku the marketPlaceSku value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withMarketPlaceSku(String marketPlaceSku) { + this.marketPlaceSku = marketPlaceSku; + return this; + } + + /** + * Get the marketPlaceSkuVersion property: The marketplace sku version. + * + * @return the marketPlaceSkuVersion value. + */ + public String marketPlaceSkuVersion() { + return this.marketPlaceSkuVersion; + } + + /** + * Set the marketPlaceSkuVersion property: The marketplace sku version. + * + * @param marketPlaceSkuVersion the marketPlaceSkuVersion value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withMarketPlaceSkuVersion(String marketPlaceSkuVersion) { + this.marketPlaceSkuVersion = marketPlaceSkuVersion; + return this; + } + + /** + * Get the deviceSku property: The device sku. + * + * @return the deviceSku value. + */ + public String deviceSku() { + return this.deviceSku; + } + + /** + * Set the deviceSku property: The device sku. + * + * @param deviceSku the deviceSku value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withDeviceSku(String deviceSku) { + this.deviceSku = deviceSku; + return this; + } + + /** + * Get the deviceVersion property: The device sku version. + * + * @return the deviceVersion value. + */ + public String deviceVersion() { + return this.deviceVersion; + } + + /** + * Set the deviceVersion property: The device sku version. + * + * @param deviceVersion the deviceVersion value to set. + * @return the AccessTokenRequest object itself. + */ + public AccessTokenRequest withDeviceVersion(String deviceVersion) { + this.deviceVersion = deviceVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (edgeMarketPlaceRegion() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property edgeMarketPlaceRegion in model AccessTokenRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccessTokenRequest.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ActionType.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ActionType.java new file mode 100644 index 000000000000..9f036d816555 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/DiskAccessToken.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/DiskAccessToken.java new file mode 100644 index 000000000000..81506ea1addd --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/DiskAccessToken.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner; + +/** An immutable client-side representation of DiskAccessToken. */ +public interface DiskAccessToken { + /** + * Gets the diskId property: The disk id. + * + * @return the diskId value. + */ + String diskId(); + + /** + * Gets the status property: The access token creation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the accessToken property: The access token. + * + * @return the accessToken value. + */ + String accessToken(); + + /** + * Gets the inner com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner object. + * + * @return the inner object. + */ + DiskAccessTokenInner innerModel(); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/IconFileUris.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/IconFileUris.java new file mode 100644 index 000000000000..5fb2d0e3261e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/IconFileUris.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.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Icon files. */ +@Fluent +public final class IconFileUris { + /* + * uri of small icon + */ + @JsonProperty(value = "small") + private String small; + + /* + * uri of medium icon + */ + @JsonProperty(value = "medium") + private String medium; + + /* + * uri of wide icon + */ + @JsonProperty(value = "wide") + private String wide; + + /* + * uri of large icon + */ + @JsonProperty(value = "large") + private String large; + + /** Creates an instance of IconFileUris class. */ + public IconFileUris() { + } + + /** + * Get the small property: uri of small icon. + * + * @return the small value. + */ + public String small() { + return this.small; + } + + /** + * Set the small property: uri of small icon. + * + * @param small the small value to set. + * @return the IconFileUris object itself. + */ + public IconFileUris withSmall(String small) { + this.small = small; + return this; + } + + /** + * Get the medium property: uri of medium icon. + * + * @return the medium value. + */ + public String medium() { + return this.medium; + } + + /** + * Set the medium property: uri of medium icon. + * + * @param medium the medium value to set. + * @return the IconFileUris object itself. + */ + public IconFileUris withMedium(String medium) { + this.medium = medium; + return this; + } + + /** + * Get the wide property: uri of wide icon. + * + * @return the wide value. + */ + public String wide() { + return this.wide; + } + + /** + * Set the wide property: uri of wide icon. + * + * @param wide the wide value to set. + * @return the IconFileUris object itself. + */ + public IconFileUris withWide(String wide) { + this.wide = wide; + return this; + } + + /** + * Get the large property: uri of large icon. + * + * @return the large value. + */ + public String large() { + return this.large; + } + + /** + * Set the large property: uri of large icon. + * + * @param large the large value to set. + * @return the IconFileUris object itself. + */ + public IconFileUris withLarge(String large) { + this.large = large; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSku.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSku.java new file mode 100644 index 000000000000..ec5697423cdf --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSku.java @@ -0,0 +1,330 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The marketplace sku. */ +@Fluent +public final class MarketplaceSku { + /* + * The catalog plan id + */ + @JsonProperty(value = "catalogPlanId", required = true) + private String catalogPlanId; + + /* + * The marketplace sku id + */ + @JsonProperty(value = "marketplaceSkuId", required = true) + private String marketplaceSkuId; + + /* + * The type of marketplace sku + */ + @JsonProperty(value = "type") + private String type; + + /* + * The display name of marketplace sku + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The summary + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * The long summary + */ + @JsonProperty(value = "longSummary") + private String longSummary; + + /* + * The description + */ + @JsonProperty(value = "description") + private String description; + + /* + * The generation + */ + @JsonProperty(value = "generation") + private String generation; + + /* + * The display rank of the sku + */ + @JsonProperty(value = "displayRank") + private Integer displayRank; + + /* + * The operating system supported + */ + @JsonProperty(value = "operatingSystem") + private SkuOperatingSystem operatingSystem; + + /* + * The marketplace sku version + */ + @JsonProperty(value = "marketplaceSkuVersions") + private List marketplaceSkuVersions; + + /** Creates an instance of MarketplaceSku class. */ + public MarketplaceSku() { + } + + /** + * Get the catalogPlanId property: The catalog plan id. + * + * @return the catalogPlanId value. + */ + public String catalogPlanId() { + return this.catalogPlanId; + } + + /** + * Set the catalogPlanId property: The catalog plan id. + * + * @param catalogPlanId the catalogPlanId value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withCatalogPlanId(String catalogPlanId) { + this.catalogPlanId = catalogPlanId; + return this; + } + + /** + * Get the marketplaceSkuId property: The marketplace sku id. + * + * @return the marketplaceSkuId value. + */ + public String marketplaceSkuId() { + return this.marketplaceSkuId; + } + + /** + * Set the marketplaceSkuId property: The marketplace sku id. + * + * @param marketplaceSkuId the marketplaceSkuId value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withMarketplaceSkuId(String marketplaceSkuId) { + this.marketplaceSkuId = marketplaceSkuId; + return this; + } + + /** + * Get the type property: The type of marketplace sku. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of marketplace sku. + * + * @param type the type value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withType(String type) { + this.type = type; + return this; + } + + /** + * Get the displayName property: The display name of marketplace sku. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of marketplace sku. + * + * @param displayName the displayName value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the summary property: The summary. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: The summary. + * + * @param summary the summary value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the longSummary property: The long summary. + * + * @return the longSummary value. + */ + public String longSummary() { + return this.longSummary; + } + + /** + * Set the longSummary property: The long summary. + * + * @param longSummary the longSummary value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withLongSummary(String longSummary) { + this.longSummary = longSummary; + return this; + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description. + * + * @param description the description value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the generation property: The generation. + * + * @return the generation value. + */ + public String generation() { + return this.generation; + } + + /** + * Set the generation property: The generation. + * + * @param generation the generation value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withGeneration(String generation) { + this.generation = generation; + return this; + } + + /** + * Get the displayRank property: The display rank of the sku. + * + * @return the displayRank value. + */ + public Integer displayRank() { + return this.displayRank; + } + + /** + * Set the displayRank property: The display rank of the sku. + * + * @param displayRank the displayRank value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withDisplayRank(Integer displayRank) { + this.displayRank = displayRank; + return this; + } + + /** + * Get the operatingSystem property: The operating system supported. + * + * @return the operatingSystem value. + */ + public SkuOperatingSystem operatingSystem() { + return this.operatingSystem; + } + + /** + * Set the operatingSystem property: The operating system supported. + * + * @param operatingSystem the operatingSystem value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withOperatingSystem(SkuOperatingSystem operatingSystem) { + this.operatingSystem = operatingSystem; + return this; + } + + /** + * Get the marketplaceSkuVersions property: The marketplace sku version. + * + * @return the marketplaceSkuVersions value. + */ + public List marketplaceSkuVersions() { + return this.marketplaceSkuVersions; + } + + /** + * Set the marketplaceSkuVersions property: The marketplace sku version. + * + * @param marketplaceSkuVersions the marketplaceSkuVersions value to set. + * @return the MarketplaceSku object itself. + */ + public MarketplaceSku withMarketplaceSkuVersions(List marketplaceSkuVersions) { + this.marketplaceSkuVersions = marketplaceSkuVersions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (catalogPlanId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property catalogPlanId in model MarketplaceSku")); + } + if (marketplaceSkuId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property marketplaceSkuId in model MarketplaceSku")); + } + if (operatingSystem() != null) { + operatingSystem().validate(); + } + if (marketplaceSkuVersions() != null) { + marketplaceSkuVersions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceSku.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSkuVersion.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSkuVersion.java new file mode 100644 index 000000000000..068b4b9cdbe2 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSkuVersion.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The marketplace sku version. */ +@Fluent +public final class MarketplaceSkuVersion { + /* + * The name of sku version + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The size of the image + */ + @JsonProperty(value = "sizeOnDiskInMb") + private Integer sizeOnDiskInMb; + + /* + * The size of the download + */ + @JsonProperty(value = "minimumDownloadSizeInMb") + private Integer minimumDownloadSizeInMb; + + /* + * The stage name + */ + @JsonProperty(value = "stageName") + private String stageName; + + /** Creates an instance of MarketplaceSkuVersion class. */ + public MarketplaceSkuVersion() { + } + + /** + * Get the name property: The name of sku version. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of sku version. + * + * @param name the name value to set. + * @return the MarketplaceSkuVersion object itself. + */ + public MarketplaceSkuVersion withName(String name) { + this.name = name; + return this; + } + + /** + * Get the sizeOnDiskInMb property: The size of the image. + * + * @return the sizeOnDiskInMb value. + */ + public Integer sizeOnDiskInMb() { + return this.sizeOnDiskInMb; + } + + /** + * Set the sizeOnDiskInMb property: The size of the image. + * + * @param sizeOnDiskInMb the sizeOnDiskInMb value to set. + * @return the MarketplaceSkuVersion object itself. + */ + public MarketplaceSkuVersion withSizeOnDiskInMb(Integer sizeOnDiskInMb) { + this.sizeOnDiskInMb = sizeOnDiskInMb; + return this; + } + + /** + * Get the minimumDownloadSizeInMb property: The size of the download. + * + * @return the minimumDownloadSizeInMb value. + */ + public Integer minimumDownloadSizeInMb() { + return this.minimumDownloadSizeInMb; + } + + /** + * Set the minimumDownloadSizeInMb property: The size of the download. + * + * @param minimumDownloadSizeInMb the minimumDownloadSizeInMb value to set. + * @return the MarketplaceSkuVersion object itself. + */ + public MarketplaceSkuVersion withMinimumDownloadSizeInMb(Integer minimumDownloadSizeInMb) { + this.minimumDownloadSizeInMb = minimumDownloadSizeInMb; + return this; + } + + /** + * Get the stageName property: The stage name. + * + * @return the stageName value. + */ + public String stageName() { + return this.stageName; + } + + /** + * Set the stageName property: The stage name. + * + * @param stageName the stageName value to set. + * @return the MarketplaceSkuVersion object itself. + */ + public MarketplaceSkuVersion withStageName(String stageName) { + this.stageName = stageName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model MarketplaceSkuVersion")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceSkuVersion.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offer.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offer.java new file mode 100644 index 000000000000..2fdf2a2f93b8 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offer.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.edgemarketplace.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import java.util.List; + +/** An immutable client-side representation of Offer. */ +public interface Offer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the contentVersion property: The content version. + * + * @return the contentVersion value. + */ + String contentVersion(); + + /** + * Gets the contentUrl property: The content url. + * + * @return the contentUrl value. + */ + String contentUrl(); + + /** + * Gets the offerContent property: The offer content. + * + * @return the offerContent value. + */ + OfferContent offerContent(); + + /** + * Gets the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + ResourceProvisioningState provisioningState(); + + /** + * Gets the marketplaceSkus property: The marketplace skus. + * + * @return the marketplaceSkus value. + */ + List marketplaceSkus(); + + /** + * Gets the inner com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner object. + * + * @return the inner object. + */ + OfferInner innerModel(); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferAvailability.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferAvailability.java new file mode 100644 index 000000000000..b98e361c3fc2 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferAvailability.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.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Says if the offer is public/private. */ +public final class OfferAvailability extends ExpandableStringEnum { + /** Static value Private for OfferAvailability. */ + public static final OfferAvailability PRIVATE = fromString("Private"); + + /** Static value Public for OfferAvailability. */ + public static final OfferAvailability PUBLIC = fromString("Public"); + + /** + * Creates a new instance of OfferAvailability value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OfferAvailability() { + } + + /** + * Creates or finds a OfferAvailability from its string representation. + * + * @param name a name to look for. + * @return the corresponding OfferAvailability. + */ + @JsonCreator + public static OfferAvailability fromString(String name) { + return fromString(name, OfferAvailability.class); + } + + /** + * Gets known OfferAvailability values. + * + * @return known OfferAvailability values. + */ + public static Collection values() { + return values(OfferAvailability.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferContent.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferContent.java new file mode 100644 index 000000000000..5739ba56b2ab --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferContent.java @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The offer content. */ +@Fluent +public final class OfferContent { + /* + * The display name of the offer + */ + @JsonProperty(value = "displayName", required = true) + private String displayName; + + /* + * The summary + */ + @JsonProperty(value = "summary") + private String summary; + + /* + * The long summary + */ + @JsonProperty(value = "longSummary") + private String longSummary; + + /* + * The description + */ + @JsonProperty(value = "description") + private String description; + + /* + * The offer id + */ + @JsonProperty(value = "offerId", required = true) + private String offerId; + + /* + * The offer type + */ + @JsonProperty(value = "offerType") + private String offerType; + + /* + * The support uri + */ + @JsonProperty(value = "supportUri") + private String supportUri; + + /* + * The popularity of the offer + */ + @JsonProperty(value = "popularity") + private Integer popularity; + + /* + * The publisher of the offer + */ + @JsonProperty(value = "offerPublisher") + private OfferPublisher offerPublisher; + + /* + * The availability of the offer + */ + @JsonProperty(value = "availability") + private OfferAvailability availability; + + /* + * The release type of the offer + */ + @JsonProperty(value = "releaseType") + private OfferReleaseType releaseType; + + /* + * The icon files + */ + @JsonProperty(value = "iconFileUris") + private IconFileUris iconFileUris; + + /* + * The terms and conditions + */ + @JsonProperty(value = "termsAndConditions") + private TermsAndConditions termsAndConditions; + + /* + * The category ids + */ + @JsonProperty(value = "categoryIds") + private List categoryIds; + + /* + * The operating systems + */ + @JsonProperty(value = "operatingSystems") + private List operatingSystems; + + /** Creates an instance of OfferContent class. */ + public OfferContent() { + } + + /** + * Get the displayName property: The display name of the offer. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the offer. + * + * @param displayName the displayName value to set. + * @return the OfferContent object itself. + */ + public OfferContent withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the summary property: The summary. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Set the summary property: The summary. + * + * @param summary the summary value to set. + * @return the OfferContent object itself. + */ + public OfferContent withSummary(String summary) { + this.summary = summary; + return this; + } + + /** + * Get the longSummary property: The long summary. + * + * @return the longSummary value. + */ + public String longSummary() { + return this.longSummary; + } + + /** + * Set the longSummary property: The long summary. + * + * @param longSummary the longSummary value to set. + * @return the OfferContent object itself. + */ + public OfferContent withLongSummary(String longSummary) { + this.longSummary = longSummary; + return this; + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description. + * + * @param description the description value to set. + * @return the OfferContent object itself. + */ + public OfferContent withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the offerId property: The offer id. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: The offer id. + * + * @param offerId the offerId value to set. + * @return the OfferContent object itself. + */ + public OfferContent withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the offerType property: The offer type. + * + * @return the offerType value. + */ + public String offerType() { + return this.offerType; + } + + /** + * Set the offerType property: The offer type. + * + * @param offerType the offerType value to set. + * @return the OfferContent object itself. + */ + public OfferContent withOfferType(String offerType) { + this.offerType = offerType; + return this; + } + + /** + * Get the supportUri property: The support uri. + * + * @return the supportUri value. + */ + public String supportUri() { + return this.supportUri; + } + + /** + * Set the supportUri property: The support uri. + * + * @param supportUri the supportUri value to set. + * @return the OfferContent object itself. + */ + public OfferContent withSupportUri(String supportUri) { + this.supportUri = supportUri; + return this; + } + + /** + * Get the popularity property: The popularity of the offer. + * + * @return the popularity value. + */ + public Integer popularity() { + return this.popularity; + } + + /** + * Set the popularity property: The popularity of the offer. + * + * @param popularity the popularity value to set. + * @return the OfferContent object itself. + */ + public OfferContent withPopularity(Integer popularity) { + this.popularity = popularity; + return this; + } + + /** + * Get the offerPublisher property: The publisher of the offer. + * + * @return the offerPublisher value. + */ + public OfferPublisher offerPublisher() { + return this.offerPublisher; + } + + /** + * Set the offerPublisher property: The publisher of the offer. + * + * @param offerPublisher the offerPublisher value to set. + * @return the OfferContent object itself. + */ + public OfferContent withOfferPublisher(OfferPublisher offerPublisher) { + this.offerPublisher = offerPublisher; + return this; + } + + /** + * Get the availability property: The availability of the offer. + * + * @return the availability value. + */ + public OfferAvailability availability() { + return this.availability; + } + + /** + * Set the availability property: The availability of the offer. + * + * @param availability the availability value to set. + * @return the OfferContent object itself. + */ + public OfferContent withAvailability(OfferAvailability availability) { + this.availability = availability; + return this; + } + + /** + * Get the releaseType property: The release type of the offer. + * + * @return the releaseType value. + */ + public OfferReleaseType releaseType() { + return this.releaseType; + } + + /** + * Set the releaseType property: The release type of the offer. + * + * @param releaseType the releaseType value to set. + * @return the OfferContent object itself. + */ + public OfferContent withReleaseType(OfferReleaseType releaseType) { + this.releaseType = releaseType; + return this; + } + + /** + * Get the iconFileUris property: The icon files. + * + * @return the iconFileUris value. + */ + public IconFileUris iconFileUris() { + return this.iconFileUris; + } + + /** + * Set the iconFileUris property: The icon files. + * + * @param iconFileUris the iconFileUris value to set. + * @return the OfferContent object itself. + */ + public OfferContent withIconFileUris(IconFileUris iconFileUris) { + this.iconFileUris = iconFileUris; + return this; + } + + /** + * Get the termsAndConditions property: The terms and conditions. + * + * @return the termsAndConditions value. + */ + public TermsAndConditions termsAndConditions() { + return this.termsAndConditions; + } + + /** + * Set the termsAndConditions property: The terms and conditions. + * + * @param termsAndConditions the termsAndConditions value to set. + * @return the OfferContent object itself. + */ + public OfferContent withTermsAndConditions(TermsAndConditions termsAndConditions) { + this.termsAndConditions = termsAndConditions; + return this; + } + + /** + * Get the categoryIds property: The category ids. + * + * @return the categoryIds value. + */ + public List categoryIds() { + return this.categoryIds; + } + + /** + * Set the categoryIds property: The category ids. + * + * @param categoryIds the categoryIds value to set. + * @return the OfferContent object itself. + */ + public OfferContent withCategoryIds(List categoryIds) { + this.categoryIds = categoryIds; + return this; + } + + /** + * Get the operatingSystems property: The operating systems. + * + * @return the operatingSystems value. + */ + public List operatingSystems() { + return this.operatingSystems; + } + + /** + * Set the operatingSystems property: The operating systems. + * + * @param operatingSystems the operatingSystems value to set. + * @return the OfferContent object itself. + */ + public OfferContent withOperatingSystems(List operatingSystems) { + this.operatingSystems = operatingSystems; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property displayName in model OfferContent")); + } + if (offerId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property offerId in model OfferContent")); + } + if (offerPublisher() != null) { + offerPublisher().validate(); + } + if (iconFileUris() != null) { + iconFileUris().validate(); + } + if (termsAndConditions() != null) { + termsAndConditions().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfferContent.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferListResult.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferListResult.java new file mode 100644 index 000000000000..edf11a09ada0 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferListResult.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.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Offer list operation. */ +@Fluent +public final class OfferListResult { + /* + * The Offer items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of OfferListResult class. */ + public OfferListResult() { + } + + /** + * Get the value property: The Offer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Offer items on this page. + * + * @param value the value value to set. + * @return the OfferListResult object itself. + */ + public OfferListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OfferListResult object itself. + */ + public OfferListResult 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model OfferListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfferListResult.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferPublisher.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferPublisher.java new file mode 100644 index 000000000000..3f712f2316f5 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferPublisher.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The offer publisher. */ +@Fluent +public final class OfferPublisher { + /* + * The publisher Id + */ + @JsonProperty(value = "publisherId", required = true) + private String publisherId; + + /* + * The publisher name + */ + @JsonProperty(value = "publisherDisplayName", required = true) + private String publisherDisplayName; + + /** Creates an instance of OfferPublisher class. */ + public OfferPublisher() { + } + + /** + * Get the publisherId property: The publisher Id. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: The publisher Id. + * + * @param publisherId the publisherId value to set. + * @return the OfferPublisher object itself. + */ + public OfferPublisher withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the publisherDisplayName property: The publisher name. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.publisherDisplayName; + } + + /** + * Set the publisherDisplayName property: The publisher name. + * + * @param publisherDisplayName the publisherDisplayName value to set. + * @return the OfferPublisher object itself. + */ + public OfferPublisher withPublisherDisplayName(String publisherDisplayName) { + this.publisherDisplayName = publisherDisplayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publisherId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property publisherId in model OfferPublisher")); + } + if (publisherDisplayName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property publisherDisplayName in model OfferPublisher")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfferPublisher.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferReleaseType.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferReleaseType.java new file mode 100644 index 000000000000..94fbf0067fdc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferReleaseType.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.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Offer release type. */ +public final class OfferReleaseType extends ExpandableStringEnum { + /** Static value Preview for OfferReleaseType. */ + public static final OfferReleaseType PREVIEW = fromString("Preview"); + + /** Static value GA for OfferReleaseType. */ + public static final OfferReleaseType GA = fromString("GA"); + + /** + * Creates a new instance of OfferReleaseType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OfferReleaseType() { + } + + /** + * Creates or finds a OfferReleaseType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OfferReleaseType. + */ + @JsonCreator + public static OfferReleaseType fromString(String name) { + return fromString(name, OfferReleaseType.class); + } + + /** + * Gets known OfferReleaseType values. + * + * @return known OfferReleaseType values. + */ + public static Collection values() { + return values(OfferReleaseType.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offers.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offers.java new file mode 100644 index 000000000000..4ed5e431f452 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offers.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.edgemarketplace.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 Offers. */ +public interface Offers { + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * List Offer resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context); + + /** + * List Offer resources by 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 the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(); + + /** + * List Offer resources by subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Offer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context); + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @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 Offer along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String offerId, Context context); + + /** + * Get a Offer. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @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 Offer. + */ + Offer get(String resourceUri, String offerId); + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token. + */ + DiskAccessToken generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body); + + /** + * A long-running resource action. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 disk access token. + */ + DiskAccessToken generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body, Context context); + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 access token along with {@link Response}. + */ + Response getAccessTokenWithResponse( + String resourceUri, String offerId, AccessTokenReadRequest body, Context context); + + /** + * get access token. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param offerId Id of the offer. + * @param body The content of the action request. + * @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 access token. + */ + DiskAccessToken getAccessToken(String resourceUri, String offerId, AccessTokenReadRequest body); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operation.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operation.java new file mode 100644 index 000000000000..a4d5118b7e7f --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operation.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.edgemarketplace.models; + +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationDisplay.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationDisplay.java new file mode 100644 index 000000000000..bcc3812d7497 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationListResult.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationListResult.java new file mode 100644 index 000000000000..f47e085159e6 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationListResult.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.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operations.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operations.java new file mode 100644 index 000000000000..cdaff16d80cc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Origin.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Origin.java new file mode 100644 index 000000000000..4cbc01020f28 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Origin.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.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publisher.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publisher.java new file mode 100644 index 000000000000..941e25a228b6 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publisher.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.edgemarketplace.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; + +/** An immutable client-side representation of Publisher. */ +public interface Publisher { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + ResourceProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner object. + * + * @return the inner object. + */ + PublisherInner innerModel(); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/PublisherListResult.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/PublisherListResult.java new file mode 100644 index 000000000000..dae71d0ab07e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/PublisherListResult.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.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a Publisher list operation. */ +@Fluent +public final class PublisherListResult { + /* + * The Publisher items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of PublisherListResult class. */ + public PublisherListResult() { + } + + /** + * Get the value property: The Publisher items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The Publisher items on this page. + * + * @param value the value value to set. + * @return the PublisherListResult object itself. + */ + public PublisherListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PublisherListResult object itself. + */ + public PublisherListResult 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) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model PublisherListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PublisherListResult.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publishers.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publishers.java new file mode 100644 index 000000000000..80e387aa812a --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publishers.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.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 Publishers. */ +public interface Publishers { + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * List Publisher resources by parent. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceUri, + Integer top, + Integer skip, + Integer maxPageSize, + String filter, + String skipToken, + Context context); + + /** + * List Publisher resources in 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 the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(); + + /** + * List Publisher resources in subscription. + * + * @param top The number of result items to return. + * @param skip The number of result items to skip. + * @param maxPageSize The maximum number of result items per page. + * @param filter Filter the result list using the given expression. + * @param skipToken Skip over when retrieving results. + * @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 of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription( + Integer top, Integer skip, Integer maxPageSize, String filter, String skipToken, Context context); + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @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 Publisher along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String publisherName, Context context); + + /** + * Get a Publisher. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource. + * @param publisherName Name of the publisher. + * @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 Publisher. + */ + Publisher get(String resourceUri, String publisherName); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ResourceProvisioningState.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ResourceProvisioningState.java new file mode 100644 index 000000000000..fa7c48641b2c --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ResourceProvisioningState.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.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The provisioning state of a resource type. */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ResourceProvisioningState. */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ResourceProvisioningState. */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ResourceProvisioningState. */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + @JsonCreator + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/SkuOperatingSystem.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/SkuOperatingSystem.java new file mode 100644 index 000000000000..784a0b0a3fc3 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/SkuOperatingSystem.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The sku operating system. */ +@Fluent +public final class SkuOperatingSystem { + /* + * The family of the operating system + */ + @JsonProperty(value = "family") + private String family; + + /* + * The type of the operating system + */ + @JsonProperty(value = "type") + private String type; + + /* + * The name of the operating system + */ + @JsonProperty(value = "name", required = true) + private String name; + + /** Creates an instance of SkuOperatingSystem class. */ + public SkuOperatingSystem() { + } + + /** + * Get the family property: The family of the operating system. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The family of the operating system. + * + * @param family the family value to set. + * @return the SkuOperatingSystem object itself. + */ + public SkuOperatingSystem withFamily(String family) { + this.family = family; + return this; + } + + /** + * Get the type property: The type of the operating system. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the operating system. + * + * @param type the type value to set. + * @return the SkuOperatingSystem object itself. + */ + public SkuOperatingSystem withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: The name of the operating system. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the operating system. + * + * @param name the name value to set. + * @return the SkuOperatingSystem object itself. + */ + public SkuOperatingSystem withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model SkuOperatingSystem")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SkuOperatingSystem.class); +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/TermsAndConditions.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/TermsAndConditions.java new file mode 100644 index 000000000000..b567d24bc633 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/TermsAndConditions.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.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Terms and conditions. */ +@Fluent +public final class TermsAndConditions { + /* + * The legal terms and conditions uri + */ + @JsonProperty(value = "legalTermsUri") + private String legalTermsUri; + + /* + * The type of legal terms + */ + @JsonProperty(value = "legalTermsType") + private String legalTermsType; + + /* + * The privacy policy uri + */ + @JsonProperty(value = "privacyPolicyUri") + private String privacyPolicyUri; + + /** Creates an instance of TermsAndConditions class. */ + public TermsAndConditions() { + } + + /** + * Get the legalTermsUri property: The legal terms and conditions uri. + * + * @return the legalTermsUri value. + */ + public String legalTermsUri() { + return this.legalTermsUri; + } + + /** + * Set the legalTermsUri property: The legal terms and conditions uri. + * + * @param legalTermsUri the legalTermsUri value to set. + * @return the TermsAndConditions object itself. + */ + public TermsAndConditions withLegalTermsUri(String legalTermsUri) { + this.legalTermsUri = legalTermsUri; + return this; + } + + /** + * Get the legalTermsType property: The type of legal terms. + * + * @return the legalTermsType value. + */ + public String legalTermsType() { + return this.legalTermsType; + } + + /** + * Set the legalTermsType property: The type of legal terms. + * + * @param legalTermsType the legalTermsType value to set. + * @return the TermsAndConditions object itself. + */ + public TermsAndConditions withLegalTermsType(String legalTermsType) { + this.legalTermsType = legalTermsType; + return this; + } + + /** + * Get the privacyPolicyUri property: The privacy policy uri. + * + * @return the privacyPolicyUri value. + */ + public String privacyPolicyUri() { + return this.privacyPolicyUri; + } + + /** + * Set the privacyPolicyUri property: The privacy policy uri. + * + * @param privacyPolicyUri the privacyPolicyUri value to set. + * @return the TermsAndConditions object itself. + */ + public TermsAndConditions withPrivacyPolicyUri(String privacyPolicyUri) { + this.privacyPolicyUri = privacyPolicyUri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/package-info.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/package-info.java new file mode 100644 index 000000000000..85feb6d00364 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/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 EdgeMarketplaceClient. Edge marketplace extensions. */ +package com.azure.resourcemanager.edgemarketplace.models; diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/package-info.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/package-info.java new file mode 100644 index 000000000000..480f73ed01e3 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/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 EdgeMarketplaceClient. Edge marketplace extensions. */ +package com.azure.resourcemanager.edgemarketplace; diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/module-info.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/module-info.java new file mode 100644 index 000000000000..f460a6a4afa2 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/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.edgemarketplace { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.edgemarketplace; + exports com.azure.resourcemanager.edgemarketplace.fluent; + exports com.azure.resourcemanager.edgemarketplace.fluent.models; + exports com.azure.resourcemanager.edgemarketplace.models; + + opens com.azure.resourcemanager.edgemarketplace.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.edgemarketplace.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgemarketplace/proxy-config.json b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgemarketplace/proxy-config.json new file mode 100644 index 000000000000..6929791826c1 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgemarketplace/proxy-config.json @@ -0,0 +1 @@ +[ [ "com.azure.resourcemanager.edgemarketplace.implementation.PublishersClientImpl$PublishersService" ], [ "com.azure.resourcemanager.edgemarketplace.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.edgemarketplace.implementation.OffersClientImpl$OffersService" ] ] \ No newline at end of file diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgemarketplace/reflect-config.json b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgemarketplace/reflect-config.json new file mode 100644 index 000000000000..e78da0c6d904 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-edgemarketplace/reflect-config.json @@ -0,0 +1,121 @@ +[ { + "name" : "com.azure.resourcemanager.edgemarketplace.models.PublisherListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OperationListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OperationDisplay", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OfferListResult", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.fluent.models.OfferProperties", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OfferContent", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OfferPublisher", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.IconFileUris", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.TermsAndConditions", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.SkuOperatingSystem", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.MarketplaceSkuVersion", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.Origin", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.ActionType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OfferAvailability", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +}, { + "name" : "com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType", + "allDeclaredConstructors" : true, + "allDeclaredFields" : true, + "allDeclaredMethods" : true +} ] \ No newline at end of file diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGenerateAccessTokenSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGenerateAccessTokenSamples.java new file mode 100644 index 000000000000..59bbd31a2f3e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGenerateAccessTokenSamples.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; + +/** Samples for Offers GenerateAccessToken. */ +public final class OffersGenerateAccessTokenSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GenerateAccessToken.json + */ + /** + * Sample code: Generate AccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void generateAccessToken(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .generateAccessToken( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "0001-com-ubuntu-pro-jammy", + new AccessTokenRequest() + .withPublisherName("ubuntu") + .withEdgeMarketPlaceRegion("EastUS2Euap") + .withEgeMarketPlaceResourceId("testid") + .withHypervGeneration("V2") + .withMarketPlaceSku("2022-datacenter-azure-edition-core") + .withMarketPlaceSkuVersion("20348.1129.221007") + .withDeviceSku("edge") + .withDeviceVersion("1.0.18062.1"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetAccessTokenSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetAccessTokenSamples.java new file mode 100644 index 000000000000..0a4083ba6757 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetAccessTokenSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; + +/** Samples for Offers GetAccessToken. */ +public final class OffersGetAccessTokenSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GetAccessToken.json + */ + /** + * Sample code: Get AccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void getAccessToken(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .getAccessTokenWithResponse( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "0001-com-ubuntu-pro-jammy", + new AccessTokenReadRequest().withRequestId("1.0.18062.1"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetSamples.java new file mode 100644 index 000000000000..f8b79330b690 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Offers Get. */ +public final class OffersGetSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GetOffer.json + */ + /** + * Sample code: Get offer. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void getOffer(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .getWithResponse( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "0001-com-ubuntu-pro-jammy", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionSamples.java new file mode 100644 index 000000000000..6faa2d5f1e55 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Offers ListBySubscription. */ +public final class OffersListBySubscriptionSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListOffersBySubscription.json + */ + /** + * Sample code: List offers by subscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listOffersBySubscription( + com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.offers().listBySubscription(null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListSamples.java new file mode 100644 index 000000000000..a89852352738 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Offers List. */ +public final class OffersListSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListOffers.json + */ + /** + * Sample code: List offers. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listOffers(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .offers() + .list( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + null, + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListSamples.java new file mode 100644 index 000000000000..c25cbb568ca9 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListOperations.json + */ + /** + * Sample code: List operations. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listOperations(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersGetSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersGetSamples.java new file mode 100644 index 000000000000..94cf91005ec2 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Publishers Get. */ +public final class PublishersGetSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/GetPublisher.json + */ + /** + * Sample code: Get publisher. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void getPublisher(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .publishers() + .getWithResponse( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + "canonical", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionSamples.java new file mode 100644 index 000000000000..068767d11a01 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Publishers ListBySubscription. */ +public final class PublishersListBySubscriptionSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListPublishersBySubscription.json + */ + /** + * Sample code: List publishers by subscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listPublishersBySubscription( + com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.publishers().listBySubscription(null, null, null, null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListSamples.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListSamples.java new file mode 100644 index 000000000000..39b8f1799250 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** Samples for Publishers List. */ +public final class PublishersListSamples { + /* + * x-ms-original-file: specification/edgemarketplace/resource-manager/Microsoft.EdgeMarketplace/preview/2023-08-01-preview/examples/ListPublishers.json + */ + /** + * Sample code: List publishers. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void listPublishers(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager + .publishers() + .list( + "subscriptions/4bed37fd-19a1-4d31-8b44-40267555bec5/resourceGroups/edgemarketplace-rg/providers/Microsoft.DataBoxEdge/dataBoxEdgeDevices/edgemarketplace-demo", + null, + null, + null, + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/edgemarketplace/ci.yml b/sdk/edgemarketplace/ci.yml new file mode 100644 index 000000000000..3e68fada3ea9 --- /dev/null +++ b/sdk/edgemarketplace/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/edgemarketplace/ci.yml + - sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/ + exclude: + - sdk/edgemarketplace/pom.xml + - sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/edgemarketplace/ci.yml + - sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/ + exclude: + - sdk/edgemarketplace/pom.xml + - sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/pom.xml + +parameters: + - name: release_azureresourcemanageredgemarketplace + displayName: azure-resourcemanager-edgemarketplace + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: edgemarketplace + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-edgemarketplace + groupId: com.azure.resourcemanager + safeName: azureresourcemanageredgemarketplace + releaseInBatch: ${{ parameters.release_azureresourcemanageredgemarketplace }} diff --git a/sdk/edgemarketplace/pom.xml b/sdk/edgemarketplace/pom.xml new file mode 100644 index 000000000000..a121c83e5ab5 --- /dev/null +++ b/sdk/edgemarketplace/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-edgemarketplace-service + pom + 1.0.0 + + + azure-resourcemanager-edgemarketplace + +