diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 83a1758d6b01..29af6311495a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -517,6 +517,7 @@ com.azure.resourcemanager:azure-resourcemanager-disconnectedoperations;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-compute-recommender;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-computelimit;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;1.0.0-beta.1;1.0.0-beta.1 +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 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 6c9d431da122..013cf1c94357 100644 --- a/pom.xml +++ b/pom.xml @@ -105,6 +105,7 @@ sdk/durabletask sdk/dynatrace sdk/easm + sdk/edgemarketplace sdk/edgeorder sdk/edgezones sdk/education diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/CHANGELOG.md b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/CHANGELOG.md new file mode 100644 index 000000000000..1e0c4814d158 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0-beta.1 (2026-01-22) + +- Azure Resource Manager Edge Marketplace client library for Java. This package contains Microsoft Azure SDK for Edge Marketplace Management SDK. Edge marketplace extensions. Package api-version 2025-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-edgemarketplace Java SDK. + diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/README.md b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/README.md new file mode 100644 index 000000000000..b376af2ecfe7 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Edge Marketplace client library for Java + +Azure Resource Manager Edge Marketplace client library for Java. + +This package contains Microsoft Azure SDK for Edge Marketplace Management SDK. Edge marketplace extensions. Package api-version 2025-10-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-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 + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +EdgeMarketplaceManager manager = EdgeMarketplaceManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/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_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md new file mode 100644 index 000000000000..91552afa5a3e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/SAMPLE.md @@ -0,0 +1,244 @@ +# 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: 2025-10-01-preview/GenerateAccessToken.json + */ + /** + * Sample code: Offers_GenerateAccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void + offersGenerateAccessToken(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: 2025-10-01-preview/GetOffer.json + */ + /** + * Sample code: Offers_Get. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void offersGet(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: 2025-10-01-preview/GetAccessToken.json + */ + /** + * Sample code: Offers_GetAccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void offersGetAccessToken(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: 2025-10-01-preview/ListOffers.json + */ + /** + * Sample code: Offers_List. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void offersList(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: 2025-10-01-preview/ListOffersBySubscription.json + */ + /** + * Sample code: Offers_ListBySubscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void + offersListBySubscription(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.offers().listBySubscription(com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-10-01-preview/ListOperations.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void operationsList(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: 2025-10-01-preview/GetPublisher.json + */ + /** + * Sample code: Publishers_Get. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void publishersGet(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: 2025-10-01-preview/ListPublishers.json + */ + /** + * Sample code: Publishers_List. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void publishersList(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: 2025-10-01-preview/ListPublishersBySubscription.json + */ + /** + * Sample code: Publishers_ListBySubscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void + publishersListBySubscription(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.publishers().listBySubscription(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..9a58775972c5 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-edgemarketplace + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Edge Marketplace Management + This package contains Microsoft Azure SDK for Edge Marketplace Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Edge marketplace extensions. Package api-version 2025-10-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + diff --git a/sdk/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..71d465bbe190 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/EdgeMarketplaceManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.edgemarketplace.fluent.EdgeMarketplaceManagementClient; +import com.azure.resourcemanager.edgemarketplace.implementation.EdgeMarketplaceManagementClientBuilder; +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.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to EdgeMarketplaceManager. + * Edge marketplace extensions. + */ +public final class EdgeMarketplaceManager { + private Operations operations; + + private Offers offers; + + private Publishers publishers; + + private final EdgeMarketplaceManagementClient 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 EdgeMarketplaceManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Edge Marketplace service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Edge Marketplace 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 Edge Marketplace service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Edge Marketplace 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 static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-edgemarketplace.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Edge Marketplace service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Edge Marketplace service API instance. + */ + public EdgeMarketplaceManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.edgemarketplace") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new EdgeMarketplaceManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * 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 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 wrapped service client EdgeMarketplaceManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client EdgeMarketplaceManagementClient. + */ + public EdgeMarketplaceManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceManagementClient.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceManagementClient.java new file mode 100644 index 000000000000..46691ef05da5 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceManagementClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for EdgeMarketplaceManagementClient class. + */ +public interface EdgeMarketplaceManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the 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(); + + /** + * Gets the PublishersClient object to access its operations. + * + * @return the PublishersClient object. + */ + PublishersClient getPublishers(); +} 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..bba726976845 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OffersClient.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 { + /** + * 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); + + /** + * 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); + + /** + * 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 long-running operation. + */ + @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 long-running operation. + */ + @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 response. + */ + @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 response. + */ + @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); + + /** + * List Offer resources by subscription ID. + * + * @throws com.azure.core.management.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 ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Context context); +} 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..a44d34920703 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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..f3c9c7db8cf4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/PublishersClient.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 { + /** + * 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); + + /** + * 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 by subscription ID. + * + * @throws com.azure.core.management.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 by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySubscription(Context context); +} 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..a51f44d94bdf --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/DiskAccessTokenInner.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The disk access token. + */ +@Immutable +public final class DiskAccessTokenInner implements JsonSerializable { + /* + * The disk id. + */ + private String diskId; + + /* + * The access token creation status. + */ + private String status; + + /* + * The access token. + */ + private String accessToken; + + /** + * Creates an instance of DiskAccessTokenInner class. + */ + private DiskAccessTokenInner() { + } + + /** + * Get the diskId property: The disk id. + * + * @return the diskId value. + */ + public String diskId() { + return this.diskId; + } + + /** + * Get the status property: The access token creation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Get the accessToken property: The access token. + * + * @return the accessToken value. + */ + public String accessToken() { + return this.accessToken; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("accessToken", this.accessToken); + jsonWriter.writeStringField("diskId", this.diskId); + jsonWriter.writeStringField("status", this.status); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiskAccessTokenInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiskAccessTokenInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DiskAccessTokenInner. + */ + public static DiskAccessTokenInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiskAccessTokenInner deserializedDiskAccessTokenInner = new DiskAccessTokenInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accessToken".equals(fieldName)) { + deserializedDiskAccessTokenInner.accessToken = reader.getString(); + } else if ("diskId".equals(fieldName)) { + deserializedDiskAccessTokenInner.diskId = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedDiskAccessTokenInner.status = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiskAccessTokenInner; + }); + } +} 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..973581174bc6 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferInner.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgemarketplace.models.OfferProperties; +import java.io.IOException; + +/** + * An offer. + */ +@Immutable +public final class OfferInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private OfferProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OfferInner class. + */ + private OfferInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public OfferProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfferInner. + */ + public static OfferInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferInner deserializedOfferInner = new OfferInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOfferInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOfferInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOfferInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedOfferInner.properties = OfferProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOfferInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOfferInner; + }); + } +} 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..2f54e303fb07 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgemarketplace.models.ActionType; +import com.azure.resourcemanager.edgemarketplace.models.OperationDisplay; +import com.azure.resourcemanager.edgemarketplace.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + 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" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private 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 Azure Resource Manager/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; + } + + /** + * 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: Extensible 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} 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..74e6a14432cf --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherInner.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgemarketplace.models.PublisherProperties; +import java.io.IOException; + +/** + * A publisher who provides offers. + */ +@Immutable +public final class PublisherInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PublisherProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PublisherInner class. + */ + private PublisherInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PublisherProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublisherInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublisherInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PublisherInner. + */ + public static PublisherInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PublisherInner deserializedPublisherInner = new PublisherInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPublisherInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPublisherInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPublisherInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPublisherInner.properties = PublisherProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPublisherInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPublisherInner; + }); + } +} 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..a6d3d3e18e91 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for EdgeMarketplace. + * 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..93acf4611558 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for EdgeMarketplace. + * 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..2707f1abeeba --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/DiskAccessTokenImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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/EdgeMarketplaceManagementClientBuilder.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientBuilder.java new file mode 100644 index 000000000000..5a9194866e4d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 EdgeMarketplaceManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { EdgeMarketplaceManagementClientImpl.class }) +public final class EdgeMarketplaceManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the EdgeMarketplaceManagementClientBuilder. + */ + public EdgeMarketplaceManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the EdgeMarketplaceManagementClientBuilder. + */ + public EdgeMarketplaceManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the EdgeMarketplaceManagementClientBuilder. + */ + public EdgeMarketplaceManagementClientBuilder 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 EdgeMarketplaceManagementClientBuilder. + */ + public EdgeMarketplaceManagementClientBuilder 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 EdgeMarketplaceManagementClientBuilder. + */ + public EdgeMarketplaceManagementClientBuilder 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 EdgeMarketplaceManagementClientBuilder. + */ + public EdgeMarketplaceManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of EdgeMarketplaceManagementClientImpl with the provided parameters. + * + * @return an instance of EdgeMarketplaceManagementClientImpl. + */ + public EdgeMarketplaceManagementClientImpl 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(); + EdgeMarketplaceManagementClientImpl client = new EdgeMarketplaceManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientImpl.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientImpl.java new file mode 100644 index 000000000000..6c8c382c0f31 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.edgemarketplace.fluent.EdgeMarketplaceManagementClient; +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 EdgeMarketplaceManagementClientImpl type. + */ +@ServiceClient(builder = EdgeMarketplaceManagementClientBuilder.class) +public final class EdgeMarketplaceManagementClientImpl implements EdgeMarketplaceManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The 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; + } + + /** + * 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; + } + + /** + * Initializes an instance of EdgeMarketplaceManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + EdgeMarketplaceManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2025-10-01-preview"; + this.operations = new OperationsClientImpl(this); + this.offers = new OffersClientImpl(this); + this.publishers = new PublishersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EdgeMarketplaceManagementClientImpl.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..09bf31ffa7cf --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OfferImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.Offer; +import com.azure.resourcemanager.edgemarketplace.models.OfferProperties; + +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 OfferProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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..c4937d3fa00d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersClientImpl.java @@ -0,0 +1,880 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.edgemarketplace.fluent.OffersClient; +import com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.azure.resourcemanager.edgemarketplace.implementation.models.OfferListResult; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; +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 EdgeMarketplaceManagementClientImpl client; + + /** + * Initializes an instance of OffersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OffersClientImpl(EdgeMarketplaceManagementClientImpl client) { + this.service = RestProxy.create(OffersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeMarketplaceManagementClientOffers to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EdgeMarketplaceManagementClientOffers") + public interface OffersService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") 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" }) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") 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" }) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") 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); + + @Post("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> generateAccessToken(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("offerId") String offerId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AccessTokenRequest body, Context context); + + @Post("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/generateAccessToken") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response generateAccessTokenSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("offerId") String offerId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AccessTokenRequest body, Context context); + + @Post("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/getAccessToken") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAccessToken(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("offerId") String offerId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AccessTokenReadRequest body, Context context); + + @Post("/{resourceUri}/providers/Microsoft.EdgeMarketplace/offers/{offerId}/getAccessToken") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getAccessTokenSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, @PathParam("offerId") String offerId, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AccessTokenReadRequest body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/offers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscription(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/offers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, 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 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + final String accept = "application/json"; + return service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OfferInner get(String resourceUri, String offerId) { + return getWithResponse(resourceUri, offerId, Context.NONE).getValue(); + } + + /** + * 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceUri, Integer top, Integer skip, Integer maxPageSize, + String filter, String skipToken) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, top, skip, maxPageSize, filter, skipToken, accept, Context.NONE); + return 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceUri, Integer top, Integer skip, Integer maxPageSize, + String filter, String skipToken, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, top, skip, maxPageSize, filter, skipToken, accept, context); + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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<>(() -> listSinglePage(resourceUri, top, skip, maxPageSize, filter, skipToken), + nextLink -> listNextSinglePage(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 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<>( + () -> listSinglePage(resourceUri, top, skip, maxPageSize, filter, skipToken, context), + nextLink -> listNextSinglePage(nextLink, 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 response body along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> generateAccessTokenWithResponseAsync(String resourceUri, String offerId, + AccessTokenRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.generateAccessToken(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, offerId, contentType, accept, body, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response generateAccessTokenWithResponse(String resourceUri, String offerId, + AccessTokenRequest body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.generateAccessTokenSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + offerId, contentType, accept, body, Context.NONE); + } + + /** + * 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response generateAccessTokenWithResponse(String resourceUri, String offerId, + AccessTokenRequest body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.generateAccessTokenSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, + offerId, contentType, accept, body, 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 long-running operation. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessTokenInner> + beginGenerateAccessToken(String resourceUri, String offerId, AccessTokenRequest body) { + Response response = generateAccessTokenWithResponse(resourceUri, offerId, body); + return this.client.getLroResult(response, + DiskAccessTokenInner.class, DiskAccessTokenInner.class, Context.NONE); + } + + /** + * 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 long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiskAccessTokenInner> + beginGenerateAccessToken(String resourceUri, String offerId, AccessTokenRequest body, Context context) { + Response response = generateAccessTokenWithResponse(resourceUri, offerId, body, context); + return this.client.getLroResult(response, + 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 response body 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessTokenInner generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body) { + return beginGenerateAccessToken(resourceUri, offerId, body).getFinalResult(); + } + + /** + * 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 response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessTokenInner generateAccessToken(String resourceUri, String offerId, AccessTokenRequest body, + Context context) { + return beginGenerateAccessToken(resourceUri, offerId, body, context).getFinalResult(); + } + + /** + * 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getAccessToken(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, offerId, contentType, accept, body, 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.getAccessTokenSync(this.client.getEndpoint(), this.client.getApiVersion(), resourceUri, offerId, + contentType, accept, body, 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiskAccessTokenInner getAccessToken(String resourceUri, String offerId, AccessTokenReadRequest body) { + return getAccessTokenWithResponse(resourceUri, offerId, body, Context.NONE).getValue(); + } + + /** + * List Offer resources by subscription ID. + * + * @throws ManagementException 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() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), 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 ID. + * + * @throws ManagementException 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() { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Offer resources by subscription ID. + * + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage() { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Offer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Offer resources by subscription ID. + * + * @throws ManagementException 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() { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List Offer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Context context) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/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..252501bb2ab4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersImpl.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 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 PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + 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; + } + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OfferImpl(inner1, this.manager())); + } + + 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..9e138a23c80e --- /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) TypeSpec 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..8d900bcd86fc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.implementation.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 EdgeMarketplaceManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(EdgeMarketplaceManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeMarketplaceManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EdgeMarketplaceManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.EdgeMarketplace/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.EdgeMarketplace/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") 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("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * 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() { + 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. + * + * @throws 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. + * + * @throws 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return 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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(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 PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return 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) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/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..37f799056425 --- /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) TypeSpec 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 ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.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..d521b49d1825 --- /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) TypeSpec 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.PublisherProperties; + +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 PublisherProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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..9059181d3cf4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersClientImpl.java @@ -0,0 +1,585 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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.implementation.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 EdgeMarketplaceManagementClientImpl client; + + /** + * Initializes an instance of PublishersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PublishersClientImpl(EdgeMarketplaceManagementClientImpl client) { + this.service + = RestProxy.create(PublishersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for EdgeMarketplaceManagementClientPublishers to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "EdgeMarketplaceManagementClientPublishers") + public interface PublishersService { + @Headers({ "Content-Type: application/json" }) + @Get("/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers/{publisherName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") 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("/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers/{publisherName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") 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("/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") 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("/{resourceUri}/providers/Microsoft.EdgeMarketplace/publishers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") 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("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.EdgeMarketplace/publishers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, 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 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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) { + final String accept = "application/json"; + return service.getSync(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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PublisherInner get(String resourceUri, String publisherName) { + return getWithResponse(resourceUri, publisherName, Context.NONE).getValue(); + } + + /** + * 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceUri, Integer top, Integer skip, + Integer maxPageSize, String filter, String skipToken) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, top, skip, maxPageSize, filter, skipToken, accept, Context.NONE); + return 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. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceUri, Integer top, Integer skip, + Integer maxPageSize, String filter, String skipToken, Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + resourceUri, top, skip, maxPageSize, filter, skipToken, accept, context); + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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<>(() -> listSinglePage(resourceUri, top, skip, maxPageSize, filter, skipToken), + nextLink -> listNextSinglePage(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 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<>( + () -> listSinglePage(resourceUri, top, skip, maxPageSize, filter, skipToken, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * List Publisher resources by subscription ID. + * + * @throws ManagementException 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() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySubscription(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), 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 subscription ID. + * + * @throws ManagementException 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() { + return new PagedFlux<>(() -> listBySubscriptionSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Publisher resources by subscription ID. + * + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage() { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Publisher resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listBySubscriptionSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Publisher resources by subscription ID. + * + * @throws ManagementException 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() { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(), + nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List Publisher resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySubscription(Context context) { + return new PagedIterable<>(() -> listBySubscriptionSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the 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) { + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/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..1d37bde31b02 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 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; + } + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return ResourceManagerUtils.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 ResourceManagerUtils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription() { + PagedIterable inner = this.serviceClient().listBySubscription(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + public PagedIterable listBySubscription(Context context) { + PagedIterable inner = this.serviceClient().listBySubscription(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PublisherImpl(inner1, this.manager())); + } + + 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/ResourceManagerUtils.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..028406579160 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OfferListResult.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OfferListResult.java new file mode 100644 index 000000000000..7191454da54b --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OfferListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Offer list operation. + */ +@Immutable +public final class OfferListResult implements JsonSerializable { + /* + * The Offer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OfferListResult class. + */ + private OfferListResult() { + } + + /** + * Get the value property: The Offer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfferListResult. + */ + public static OfferListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferListResult deserializedOfferListResult = new OfferListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OfferInner.fromJson(reader1)); + deserializedOfferListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOfferListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOfferListResult; + }); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OperationListResult.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..662975ed87c7 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; +import java.io.IOException; +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 implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/PublisherListResult.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/PublisherListResult.java new file mode 100644 index 000000000000..1334a9f82b40 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/PublisherListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Publisher list operation. + */ +@Immutable +public final class PublisherListResult implements JsonSerializable { + /* + * The Publisher items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PublisherListResult class. + */ + private PublisherListResult() { + } + + /** + * Get the value property: The Publisher items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublisherListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublisherListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PublisherListResult. + */ + public static PublisherListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PublisherListResult deserializedPublisherListResult = new PublisherListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> PublisherInner.fromJson(reader1)); + deserializedPublisherListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPublisherListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPublisherListResult; + }); + } +} 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..4542d7f975a2 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for EdgeMarketplace. + * 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..2705d03128f5 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenReadRequest.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Access token request object. + */ +@Fluent +public final class AccessTokenReadRequest implements JsonSerializable { + /* + * The name of the publisher. + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("requestId", this.requestId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccessTokenReadRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccessTokenReadRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AccessTokenReadRequest. + */ + public static AccessTokenReadRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccessTokenReadRequest deserializedAccessTokenReadRequest = new AccessTokenReadRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("requestId".equals(fieldName)) { + deserializedAccessTokenReadRequest.requestId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAccessTokenReadRequest; + }); + } +} 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..a62e37d2237f --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenRequest.java @@ -0,0 +1,282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Access token request object. + */ +@Fluent +public final class AccessTokenRequest implements JsonSerializable { + /* + * The name of the publisher. + */ + private String publisherName; + + /* + * The region where the disk will be created. + */ + private String edgeMarketPlaceRegion; + + /* + * The region where the disk will be created. + */ + private String egeMarketPlaceResourceId; + + /* + * The hyperv version. + */ + private String hypervGeneration; + + /* + * The marketplace sku. + */ + private String marketPlaceSku; + + /* + * The marketplace sku version. + */ + private String marketPlaceSkuVersion; + + /* + * The device sku. + */ + private String deviceSku; + + /* + * The device sku version. + */ + 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("edgeMarketPlaceRegion", this.edgeMarketPlaceRegion); + jsonWriter.writeStringField("publisherName", this.publisherName); + jsonWriter.writeStringField("egeMarketPlaceResourceId", this.egeMarketPlaceResourceId); + jsonWriter.writeStringField("hypervGeneration", this.hypervGeneration); + jsonWriter.writeStringField("marketPlaceSku", this.marketPlaceSku); + jsonWriter.writeStringField("marketPlaceSkuVersion", this.marketPlaceSkuVersion); + jsonWriter.writeStringField("deviceSku", this.deviceSku); + jsonWriter.writeStringField("deviceVersion", this.deviceVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AccessTokenRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AccessTokenRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AccessTokenRequest. + */ + public static AccessTokenRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AccessTokenRequest deserializedAccessTokenRequest = new AccessTokenRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("edgeMarketPlaceRegion".equals(fieldName)) { + deserializedAccessTokenRequest.edgeMarketPlaceRegion = reader.getString(); + } else if ("publisherName".equals(fieldName)) { + deserializedAccessTokenRequest.publisherName = reader.getString(); + } else if ("egeMarketPlaceResourceId".equals(fieldName)) { + deserializedAccessTokenRequest.egeMarketPlaceResourceId = reader.getString(); + } else if ("hypervGeneration".equals(fieldName)) { + deserializedAccessTokenRequest.hypervGeneration = reader.getString(); + } else if ("marketPlaceSku".equals(fieldName)) { + deserializedAccessTokenRequest.marketPlaceSku = reader.getString(); + } else if ("marketPlaceSkuVersion".equals(fieldName)) { + deserializedAccessTokenRequest.marketPlaceSkuVersion = reader.getString(); + } else if ("deviceSku".equals(fieldName)) { + deserializedAccessTokenRequest.deviceSku = reader.getString(); + } else if ("deviceVersion".equals(fieldName)) { + deserializedAccessTokenRequest.deviceVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAccessTokenRequest; + }); + } +} 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..bf20375b828e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + 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. + */ + 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..0501a6b89377 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/DiskAccessToken.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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..e06675b3af73 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/IconFileUris.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Icon files. + */ +@Immutable +public final class IconFileUris implements JsonSerializable { + /* + * uri of small icon + */ + private String small; + + /* + * uri of medium icon + */ + private String medium; + + /* + * uri of wide icon + */ + private String wide; + + /* + * uri of large icon + */ + private String large; + + /** + * Creates an instance of IconFileUris class. + */ + private IconFileUris() { + } + + /** + * Get the small property: uri of small icon. + * + * @return the small value. + */ + public String small() { + return this.small; + } + + /** + * Get the medium property: uri of medium icon. + * + * @return the medium value. + */ + public String medium() { + return this.medium; + } + + /** + * Get the wide property: uri of wide icon. + * + * @return the wide value. + */ + public String wide() { + return this.wide; + } + + /** + * Get the large property: uri of large icon. + * + * @return the large value. + */ + public String large() { + return this.large; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("small", this.small); + jsonWriter.writeStringField("medium", this.medium); + jsonWriter.writeStringField("wide", this.wide); + jsonWriter.writeStringField("large", this.large); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IconFileUris from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IconFileUris if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the IconFileUris. + */ + public static IconFileUris fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IconFileUris deserializedIconFileUris = new IconFileUris(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("small".equals(fieldName)) { + deserializedIconFileUris.small = reader.getString(); + } else if ("medium".equals(fieldName)) { + deserializedIconFileUris.medium = reader.getString(); + } else if ("wide".equals(fieldName)) { + deserializedIconFileUris.wide = reader.getString(); + } else if ("large".equals(fieldName)) { + deserializedIconFileUris.large = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIconFileUris; + }); + } +} 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..1787319c4819 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSku.java @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The marketplace sku. + */ +@Immutable +public final class MarketplaceSku implements JsonSerializable { + /* + * The catalog plan id + */ + private String catalogPlanId; + + /* + * The marketplace sku id + */ + private String marketplaceSkuId; + + /* + * The type of marketplace sku + */ + private String type; + + /* + * The display name of marketplace sku + */ + private String displayName; + + /* + * The summary + */ + private String summary; + + /* + * The long summary + */ + private String longSummary; + + /* + * The description + */ + private String description; + + /* + * The generation + */ + private String generation; + + /* + * The display rank of the sku + */ + private Integer displayRank; + + /* + * The operating system supported + */ + private SkuOperatingSystem operatingSystem; + + /* + * The marketplace sku version + */ + private List marketplaceSkuVersions; + + /** + * Creates an instance of MarketplaceSku class. + */ + private MarketplaceSku() { + } + + /** + * Get the catalogPlanId property: The catalog plan id. + * + * @return the catalogPlanId value. + */ + public String catalogPlanId() { + return this.catalogPlanId; + } + + /** + * Get the marketplaceSkuId property: The marketplace sku id. + * + * @return the marketplaceSkuId value. + */ + public String marketplaceSkuId() { + return this.marketplaceSkuId; + } + + /** + * Get the type property: The type of marketplace sku. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the displayName property: The display name of marketplace sku. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the summary property: The summary. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Get the longSummary property: The long summary. + * + * @return the longSummary value. + */ + public String longSummary() { + return this.longSummary; + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the generation property: The generation. + * + * @return the generation value. + */ + public String generation() { + return this.generation; + } + + /** + * Get the displayRank property: The display rank of the sku. + * + * @return the displayRank value. + */ + public Integer displayRank() { + return this.displayRank; + } + + /** + * Get the operatingSystem property: The operating system supported. + * + * @return the operatingSystem value. + */ + public SkuOperatingSystem operatingSystem() { + return this.operatingSystem; + } + + /** + * Get the marketplaceSkuVersions property: The marketplace sku version. + * + * @return the marketplaceSkuVersions value. + */ + public List marketplaceSkuVersions() { + return this.marketplaceSkuVersions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("catalogPlanId", this.catalogPlanId); + jsonWriter.writeStringField("marketplaceSkuId", this.marketplaceSkuId); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("summary", this.summary); + jsonWriter.writeStringField("longSummary", this.longSummary); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("generation", this.generation); + jsonWriter.writeNumberField("displayRank", this.displayRank); + jsonWriter.writeJsonField("operatingSystem", this.operatingSystem); + jsonWriter.writeArrayField("marketplaceSkuVersions", this.marketplaceSkuVersions, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceSku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceSku if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MarketplaceSku. + */ + public static MarketplaceSku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceSku deserializedMarketplaceSku = new MarketplaceSku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("catalogPlanId".equals(fieldName)) { + deserializedMarketplaceSku.catalogPlanId = reader.getString(); + } else if ("marketplaceSkuId".equals(fieldName)) { + deserializedMarketplaceSku.marketplaceSkuId = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMarketplaceSku.type = reader.getString(); + } else if ("displayName".equals(fieldName)) { + deserializedMarketplaceSku.displayName = reader.getString(); + } else if ("summary".equals(fieldName)) { + deserializedMarketplaceSku.summary = reader.getString(); + } else if ("longSummary".equals(fieldName)) { + deserializedMarketplaceSku.longSummary = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedMarketplaceSku.description = reader.getString(); + } else if ("generation".equals(fieldName)) { + deserializedMarketplaceSku.generation = reader.getString(); + } else if ("displayRank".equals(fieldName)) { + deserializedMarketplaceSku.displayRank = reader.getNullable(JsonReader::getInt); + } else if ("operatingSystem".equals(fieldName)) { + deserializedMarketplaceSku.operatingSystem = SkuOperatingSystem.fromJson(reader); + } else if ("marketplaceSkuVersions".equals(fieldName)) { + List marketplaceSkuVersions + = reader.readArray(reader1 -> MarketplaceSkuVersion.fromJson(reader1)); + deserializedMarketplaceSku.marketplaceSkuVersions = marketplaceSkuVersions; + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceSku; + }); + } +} 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..575c5d075c00 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSkuVersion.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The marketplace sku version. + */ +@Immutable +public final class MarketplaceSkuVersion implements JsonSerializable { + /* + * The name of sku version + */ + private String name; + + /* + * The size of the image + */ + private Integer sizeOnDiskInMb; + + /* + * The size of the download + */ + private Integer minimumDownloadSizeInMb; + + /* + * The stage name + */ + private String stageName; + + /* + * The launch type + */ + private OfferLaunchType launchType; + + /** + * Creates an instance of MarketplaceSkuVersion class. + */ + private MarketplaceSkuVersion() { + } + + /** + * Get the name property: The name of sku version. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the sizeOnDiskInMb property: The size of the image. + * + * @return the sizeOnDiskInMb value. + */ + public Integer sizeOnDiskInMb() { + return this.sizeOnDiskInMb; + } + + /** + * Get the minimumDownloadSizeInMb property: The size of the download. + * + * @return the minimumDownloadSizeInMb value. + */ + public Integer minimumDownloadSizeInMb() { + return this.minimumDownloadSizeInMb; + } + + /** + * Get the stageName property: The stage name. + * + * @return the stageName value. + */ + public String stageName() { + return this.stageName; + } + + /** + * Get the launchType property: The launch type. + * + * @return the launchType value. + */ + public OfferLaunchType launchType() { + return this.launchType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeNumberField("sizeOnDiskInMb", this.sizeOnDiskInMb); + jsonWriter.writeNumberField("minimumDownloadSizeInMb", this.minimumDownloadSizeInMb); + jsonWriter.writeStringField("stageName", this.stageName); + jsonWriter.writeStringField("launchType", this.launchType == null ? null : this.launchType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceSkuVersion from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceSkuVersion if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the MarketplaceSkuVersion. + */ + public static MarketplaceSkuVersion fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceSkuVersion deserializedMarketplaceSkuVersion = new MarketplaceSkuVersion(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedMarketplaceSkuVersion.name = reader.getString(); + } else if ("sizeOnDiskInMb".equals(fieldName)) { + deserializedMarketplaceSkuVersion.sizeOnDiskInMb = reader.getNullable(JsonReader::getInt); + } else if ("minimumDownloadSizeInMb".equals(fieldName)) { + deserializedMarketplaceSkuVersion.minimumDownloadSizeInMb = reader.getNullable(JsonReader::getInt); + } else if ("stageName".equals(fieldName)) { + deserializedMarketplaceSkuVersion.stageName = reader.getString(); + } else if ("launchType".equals(fieldName)) { + deserializedMarketplaceSkuVersion.launchType = OfferLaunchType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceSkuVersion; + }); + } +} 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..9836ae8a61b0 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offer.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; + +/** + * 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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + OfferProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.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..9058b1316cae --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferAvailability.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * OfferAvailability Enum. + */ +public final class OfferAvailability extends ExpandableStringEnum { + /** + * The offer availability is private. + */ + public static final OfferAvailability PRIVATE = fromString("Private"); + + /** + * The offer availability is public. + */ + 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. + */ + 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..23857b44b7e3 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferContent.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The offer content. + */ +@Immutable +public final class OfferContent implements JsonSerializable { + /* + * The display name of the offer + */ + private String displayName; + + /* + * The summary + */ + private String summary; + + /* + * The long summary + */ + private String longSummary; + + /* + * The description + */ + private String description; + + /* + * The offer id + */ + private String offerId; + + /* + * The offer type + */ + private String offerType; + + /* + * The support uri + */ + private String supportUri; + + /* + * The popularity of the offer + */ + private Integer popularity; + + /* + * The publisher of the offer + */ + private OfferPublisher offerPublisher; + + /* + * The availability of the offer + */ + private OfferAvailability availability; + + /* + * The release type of the offer + */ + private OfferReleaseType releaseType; + + /* + * The icon files + */ + private IconFileUris iconFileUris; + + /* + * The terms and conditions + */ + private TermsAndConditions termsAndConditions; + + /* + * The category ids + */ + private List categoryIds; + + /* + * The operating systems + */ + private List operatingSystems; + + /** + * Creates an instance of OfferContent class. + */ + private OfferContent() { + } + + /** + * Get the displayName property: The display name of the offer. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Get the summary property: The summary. + * + * @return the summary value. + */ + public String summary() { + return this.summary; + } + + /** + * Get the longSummary property: The long summary. + * + * @return the longSummary value. + */ + public String longSummary() { + return this.longSummary; + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the offerId property: The offer id. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Get the offerType property: The offer type. + * + * @return the offerType value. + */ + public String offerType() { + return this.offerType; + } + + /** + * Get the supportUri property: The support uri. + * + * @return the supportUri value. + */ + public String supportUri() { + return this.supportUri; + } + + /** + * Get the popularity property: The popularity of the offer. + * + * @return the popularity value. + */ + public Integer popularity() { + return this.popularity; + } + + /** + * Get the offerPublisher property: The publisher of the offer. + * + * @return the offerPublisher value. + */ + public OfferPublisher offerPublisher() { + return this.offerPublisher; + } + + /** + * Get the availability property: The availability of the offer. + * + * @return the availability value. + */ + public OfferAvailability availability() { + return this.availability; + } + + /** + * Get the releaseType property: The release type of the offer. + * + * @return the releaseType value. + */ + public OfferReleaseType releaseType() { + return this.releaseType; + } + + /** + * Get the iconFileUris property: The icon files. + * + * @return the iconFileUris value. + */ + public IconFileUris iconFileUris() { + return this.iconFileUris; + } + + /** + * Get the termsAndConditions property: The terms and conditions. + * + * @return the termsAndConditions value. + */ + public TermsAndConditions termsAndConditions() { + return this.termsAndConditions; + } + + /** + * Get the categoryIds property: The category ids. + * + * @return the categoryIds value. + */ + public List categoryIds() { + return this.categoryIds; + } + + /** + * Get the operatingSystems property: The operating systems. + * + * @return the operatingSystems value. + */ + public List operatingSystems() { + return this.operatingSystems; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + jsonWriter.writeStringField("offerId", this.offerId); + jsonWriter.writeStringField("summary", this.summary); + jsonWriter.writeStringField("longSummary", this.longSummary); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("offerType", this.offerType); + jsonWriter.writeStringField("supportUri", this.supportUri); + jsonWriter.writeNumberField("popularity", this.popularity); + jsonWriter.writeJsonField("offerPublisher", this.offerPublisher); + jsonWriter.writeStringField("availability", this.availability == null ? null : this.availability.toString()); + jsonWriter.writeStringField("releaseType", this.releaseType == null ? null : this.releaseType.toString()); + jsonWriter.writeJsonField("iconFileUris", this.iconFileUris); + jsonWriter.writeJsonField("termsAndConditions", this.termsAndConditions); + jsonWriter.writeArrayField("categoryIds", this.categoryIds, (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("operatingSystems", this.operatingSystems, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferContent from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferContent if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfferContent. + */ + public static OfferContent fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferContent deserializedOfferContent = new OfferContent(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedOfferContent.displayName = reader.getString(); + } else if ("offerId".equals(fieldName)) { + deserializedOfferContent.offerId = reader.getString(); + } else if ("summary".equals(fieldName)) { + deserializedOfferContent.summary = reader.getString(); + } else if ("longSummary".equals(fieldName)) { + deserializedOfferContent.longSummary = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOfferContent.description = reader.getString(); + } else if ("offerType".equals(fieldName)) { + deserializedOfferContent.offerType = reader.getString(); + } else if ("supportUri".equals(fieldName)) { + deserializedOfferContent.supportUri = reader.getString(); + } else if ("popularity".equals(fieldName)) { + deserializedOfferContent.popularity = reader.getNullable(JsonReader::getInt); + } else if ("offerPublisher".equals(fieldName)) { + deserializedOfferContent.offerPublisher = OfferPublisher.fromJson(reader); + } else if ("availability".equals(fieldName)) { + deserializedOfferContent.availability = OfferAvailability.fromString(reader.getString()); + } else if ("releaseType".equals(fieldName)) { + deserializedOfferContent.releaseType = OfferReleaseType.fromString(reader.getString()); + } else if ("iconFileUris".equals(fieldName)) { + deserializedOfferContent.iconFileUris = IconFileUris.fromJson(reader); + } else if ("termsAndConditions".equals(fieldName)) { + deserializedOfferContent.termsAndConditions = TermsAndConditions.fromJson(reader); + } else if ("categoryIds".equals(fieldName)) { + List categoryIds = reader.readArray(reader1 -> reader1.getString()); + deserializedOfferContent.categoryIds = categoryIds; + } else if ("operatingSystems".equals(fieldName)) { + List operatingSystems = reader.readArray(reader1 -> reader1.getString()); + deserializedOfferContent.operatingSystems = operatingSystems; + } else { + reader.skipChildren(); + } + } + + return deserializedOfferContent; + }); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferLaunchType.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferLaunchType.java new file mode 100644 index 000000000000..2e290c984b6d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferLaunchType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Offer launch type Enum. + */ +public final class OfferLaunchType extends ExpandableStringEnum { + /** + * The offer has been certified. + */ + public static final OfferLaunchType TRUSTED = fromString("Trusted"); + + /** + * The offer has not been certified. + */ + public static final OfferLaunchType UNKNOWN = fromString("Unknown"); + + /** + * Creates a new instance of OfferLaunchType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OfferLaunchType() { + } + + /** + * Creates or finds a OfferLaunchType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OfferLaunchType. + */ + public static OfferLaunchType fromString(String name) { + return fromString(name, OfferLaunchType.class); + } + + /** + * Gets known OfferLaunchType values. + * + * @return known OfferLaunchType values. + */ + public static Collection values() { + return values(OfferLaunchType.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferProperties.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferProperties.java new file mode 100644 index 000000000000..3e8a1a67edac --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferProperties.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The offer properties. + */ +@Immutable +public final class OfferProperties implements JsonSerializable { + /* + * The content version + */ + private String contentVersion; + + /* + * The content url + */ + private String contentUrl; + + /* + * The offer content + */ + private OfferContent offerContent; + + /* + * The resource provisioning state + */ + private ResourceProvisioningState provisioningState; + + /* + * The marketplace skus + */ + private List marketplaceSkus; + + /** + * Creates an instance of OfferProperties class. + */ + private OfferProperties() { + } + + /** + * Get the contentVersion property: The content version. + * + * @return the contentVersion value. + */ + public String contentVersion() { + return this.contentVersion; + } + + /** + * Get the contentUrl property: The content url. + * + * @return the contentUrl value. + */ + public String contentUrl() { + return this.contentUrl; + } + + /** + * Get the offerContent property: The offer content. + * + * @return the offerContent value. + */ + public OfferContent offerContent() { + return this.offerContent; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the marketplaceSkus property: The marketplace skus. + * + * @return the marketplaceSkus value. + */ + public List marketplaceSkus() { + return this.marketplaceSkus; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("offerContent", this.offerContent); + jsonWriter.writeStringField("contentVersion", this.contentVersion); + jsonWriter.writeStringField("contentUrl", this.contentUrl); + jsonWriter.writeArrayField("marketplaceSkus", this.marketplaceSkus, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfferProperties. + */ + public static OfferProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferProperties deserializedOfferProperties = new OfferProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("offerContent".equals(fieldName)) { + deserializedOfferProperties.offerContent = OfferContent.fromJson(reader); + } else if ("contentVersion".equals(fieldName)) { + deserializedOfferProperties.contentVersion = reader.getString(); + } else if ("contentUrl".equals(fieldName)) { + deserializedOfferProperties.contentUrl = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedOfferProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("marketplaceSkus".equals(fieldName)) { + List marketplaceSkus + = reader.readArray(reader1 -> MarketplaceSku.fromJson(reader1)); + deserializedOfferProperties.marketplaceSkus = marketplaceSkus; + } else { + reader.skipChildren(); + } + } + + return deserializedOfferProperties; + }); + } +} 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..12538cc662b4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferPublisher.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The offer publisher. + */ +@Immutable +public final class OfferPublisher implements JsonSerializable { + /* + * The publisher Id + */ + private String publisherId; + + /* + * The publisher name + */ + private String publisherDisplayName; + + /** + * Creates an instance of OfferPublisher class. + */ + private OfferPublisher() { + } + + /** + * Get the publisherId property: The publisher Id. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Get the publisherDisplayName property: The publisher name. + * + * @return the publisherDisplayName value. + */ + public String publisherDisplayName() { + return this.publisherDisplayName; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publisherId", this.publisherId); + jsonWriter.writeStringField("publisherDisplayName", this.publisherDisplayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferPublisher from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferPublisher if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OfferPublisher. + */ + public static OfferPublisher fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferPublisher deserializedOfferPublisher = new OfferPublisher(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publisherId".equals(fieldName)) { + deserializedOfferPublisher.publisherId = reader.getString(); + } else if ("publisherDisplayName".equals(fieldName)) { + deserializedOfferPublisher.publisherDisplayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOfferPublisher; + }); + } +} 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..ed280a550abb --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferReleaseType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Offer release type Enum. + */ +public final class OfferReleaseType extends ExpandableStringEnum { + /** + * The offer in preview. + */ + public static final OfferReleaseType PREVIEW = fromString("Preview"); + + /** + * The offer in GA. + */ + 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. + */ + 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..59adc633153d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offers.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 { + /** + * 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); + + /** + * 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); + + /** + * 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 response. + */ + 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 response. + */ + 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); + + /** + * List Offer resources by subscription ID. + * + * @throws com.azure.core.management.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 ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Offer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(Context context); +} 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..feca923ebe58 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.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 Azure Resource Manager/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: Extensible 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..359a07adf298 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for an operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private 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; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} 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..c74ffdeff9ef --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.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..fe1300242515 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +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 { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + 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. + */ + 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..dc3b2de3e13b --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publisher.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.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 properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PublisherProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.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/PublisherProperties.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/PublisherProperties.java new file mode 100644 index 000000000000..22327de40200 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/PublisherProperties.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Publisher properties. + */ +@Immutable +public final class PublisherProperties implements JsonSerializable { + /* + * The resource provisioning state + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of PublisherProperties class. + */ + private PublisherProperties() { + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PublisherProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PublisherProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PublisherProperties. + */ + public static PublisherProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PublisherProperties deserializedPublisherProperties = new PublisherProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedPublisherProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPublisherProperties; + }); + } +} 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..b1e16550a67e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publishers.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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 { + /** + * 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); + + /** + * 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 by subscription ID. + * + * @throws com.azure.core.management.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 by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Publisher list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySubscription(Context context); +} 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..febeeeffb483 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/ResourceProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + 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. + */ + 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..040b56f83d73 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/SkuOperatingSystem.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The sku operating system. + */ +@Immutable +public final class SkuOperatingSystem implements JsonSerializable { + /* + * The family of the operating system + */ + private String family; + + /* + * The type of the operating system + */ + private String type; + + /* + * The name of the operating system + */ + private String name; + + /** + * Creates an instance of SkuOperatingSystem class. + */ + private SkuOperatingSystem() { + } + + /** + * Get the family property: The family of the operating system. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Get the type property: The type of the operating system. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the operating system. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("family", this.family); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SkuOperatingSystem from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SkuOperatingSystem if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SkuOperatingSystem. + */ + public static SkuOperatingSystem fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SkuOperatingSystem deserializedSkuOperatingSystem = new SkuOperatingSystem(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSkuOperatingSystem.name = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedSkuOperatingSystem.family = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSkuOperatingSystem.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSkuOperatingSystem; + }); + } +} 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..0fff79e1ec1d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/TermsAndConditions.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Terms and conditions. + */ +@Immutable +public final class TermsAndConditions implements JsonSerializable { + /* + * The legal terms and conditions uri + */ + private String legalTermsUri; + + /* + * The type of legal terms + */ + private String legalTermsType; + + /* + * The privacy policy uri + */ + private String privacyPolicyUri; + + /** + * Creates an instance of TermsAndConditions class. + */ + private TermsAndConditions() { + } + + /** + * Get the legalTermsUri property: The legal terms and conditions uri. + * + * @return the legalTermsUri value. + */ + public String legalTermsUri() { + return this.legalTermsUri; + } + + /** + * Get the legalTermsType property: The type of legal terms. + * + * @return the legalTermsType value. + */ + public String legalTermsType() { + return this.legalTermsType; + } + + /** + * Get the privacyPolicyUri property: The privacy policy uri. + * + * @return the privacyPolicyUri value. + */ + public String privacyPolicyUri() { + return this.privacyPolicyUri; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("legalTermsUri", this.legalTermsUri); + jsonWriter.writeStringField("legalTermsType", this.legalTermsType); + jsonWriter.writeStringField("privacyPolicyUri", this.privacyPolicyUri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TermsAndConditions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TermsAndConditions if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the TermsAndConditions. + */ + public static TermsAndConditions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TermsAndConditions deserializedTermsAndConditions = new TermsAndConditions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("legalTermsUri".equals(fieldName)) { + deserializedTermsAndConditions.legalTermsUri = reader.getString(); + } else if ("legalTermsType".equals(fieldName)) { + deserializedTermsAndConditions.legalTermsType = reader.getString(); + } else if ("privacyPolicyUri".equals(fieldName)) { + deserializedTermsAndConditions.privacyPolicyUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedTermsAndConditions; + }); + } +} 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..d373b4f7d822 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for EdgeMarketplace. + * 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..6dd7324c41d0 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/com/azure/resourcemanager/edgemarketplace/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for EdgeMarketplace. + * 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..3cfbe378aa9e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.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; + opens com.azure.resourcemanager.edgemarketplace.models to com.azure.core; + opens com.azure.resourcemanager.edgemarketplace.implementation.models to com.azure.core; +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/azure-resourcemanager-edgemarketplace_apiview_properties.json b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/azure-resourcemanager-edgemarketplace_apiview_properties.json new file mode 100644 index 000000000000..4c575e0f7933 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/azure-resourcemanager-edgemarketplace_apiview_properties.json @@ -0,0 +1,48 @@ +{ + "flavor": "azure", + "CrossLanguageDefinitionId": { + "com.azure.resourcemanager.edgemarketplace.fluent.EdgeMarketplaceManagementClient": "Microsoft.EdgeMarketplace", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient": "Microsoft.EdgeMarketplace.Offers", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.beginGenerateAccessToken": "Microsoft.EdgeMarketplace.Offers.generateAccessToken", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.generateAccessToken": "Microsoft.EdgeMarketplace.Offers.generateAccessToken", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.get": "Microsoft.EdgeMarketplace.Offers.get", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.getAccessToken": "Microsoft.EdgeMarketplace.Offers.getAccessToken", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.getAccessTokenWithResponse": "Microsoft.EdgeMarketplace.Offers.getAccessToken", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.getWithResponse": "Microsoft.EdgeMarketplace.Offers.get", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.list": "Microsoft.EdgeMarketplace.Offers.list", + "com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.listBySubscription": "Microsoft.EdgeMarketplace.Offers.listBySubscription", + "com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient": "Microsoft.EdgeMarketplace.Operations", + "com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient.list": "Azure.ResourceManager.Operations.list", + "com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient": "Microsoft.EdgeMarketplace.Publishers", + "com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.get": "Microsoft.EdgeMarketplace.Publishers.get", + "com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.getWithResponse": "Microsoft.EdgeMarketplace.Publishers.get", + "com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.list": "Microsoft.EdgeMarketplace.Publishers.list", + "com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.listBySubscription": "Microsoft.EdgeMarketplace.Publishers.listBySubscription", + "com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner": "Microsoft.EdgeMarketplace.DiskAccessToken", + "com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner": "Microsoft.EdgeMarketplace.Offer", + "com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner": "Azure.ResourceManager.CommonTypes.Operation", + "com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner": "Microsoft.EdgeMarketplace.Publisher", + "com.azure.resourcemanager.edgemarketplace.implementation.EdgeMarketplaceManagementClientBuilder": "Microsoft.EdgeMarketplace", + "com.azure.resourcemanager.edgemarketplace.implementation.models.OfferListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.edgemarketplace.implementation.models.OperationListResult": "Azure.ResourceManager.CommonTypes.OperationListResult", + "com.azure.resourcemanager.edgemarketplace.implementation.models.PublisherListResult": "Azure.ResourceManager.ResourceListResult", + "com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest": "Microsoft.EdgeMarketplace.AccessTokenReadRequest", + "com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest": "Microsoft.EdgeMarketplace.AccessTokenRequest", + "com.azure.resourcemanager.edgemarketplace.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "com.azure.resourcemanager.edgemarketplace.models.IconFileUris": "Microsoft.EdgeMarketplace.IconFileUris", + "com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku": "Microsoft.EdgeMarketplace.MarketplaceSku", + "com.azure.resourcemanager.edgemarketplace.models.MarketplaceSkuVersion": "Microsoft.EdgeMarketplace.MarketplaceSkuVersion", + "com.azure.resourcemanager.edgemarketplace.models.OfferAvailability": "Microsoft.EdgeMarketplace.OfferAvailability", + "com.azure.resourcemanager.edgemarketplace.models.OfferContent": "Microsoft.EdgeMarketplace.OfferContent", + "com.azure.resourcemanager.edgemarketplace.models.OfferLaunchType": "Microsoft.EdgeMarketplace.OfferLaunchType", + "com.azure.resourcemanager.edgemarketplace.models.OfferProperties": "Microsoft.EdgeMarketplace.OfferProperties", + "com.azure.resourcemanager.edgemarketplace.models.OfferPublisher": "Microsoft.EdgeMarketplace.OfferPublisher", + "com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType": "Microsoft.EdgeMarketplace.OfferReleaseType", + "com.azure.resourcemanager.edgemarketplace.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "com.azure.resourcemanager.edgemarketplace.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "com.azure.resourcemanager.edgemarketplace.models.PublisherProperties": "Microsoft.EdgeMarketplace.PublisherProperties", + "com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState": "Azure.ResourceManager.ResourceProvisioningState", + "com.azure.resourcemanager.edgemarketplace.models.SkuOperatingSystem": "Microsoft.EdgeMarketplace.SkuOperatingSystem", + "com.azure.resourcemanager.edgemarketplace.models.TermsAndConditions": "Microsoft.EdgeMarketplace.TermsAndConditions" + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/azure-resourcemanager-edgemarketplace_metadata.json b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/azure-resourcemanager-edgemarketplace_metadata.json new file mode 100644 index 000000000000..3e60425f3921 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/META-INF/azure-resourcemanager-edgemarketplace_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersion":"2025-10-01-preview","crossLanguageDefinitions":{"com.azure.resourcemanager.edgemarketplace.fluent.EdgeMarketplaceManagementClient":"Microsoft.EdgeMarketplace","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient":"Microsoft.EdgeMarketplace.Offers","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.beginGenerateAccessToken":"Microsoft.EdgeMarketplace.Offers.generateAccessToken","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.generateAccessToken":"Microsoft.EdgeMarketplace.Offers.generateAccessToken","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.get":"Microsoft.EdgeMarketplace.Offers.get","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.getAccessToken":"Microsoft.EdgeMarketplace.Offers.getAccessToken","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.getAccessTokenWithResponse":"Microsoft.EdgeMarketplace.Offers.getAccessToken","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.getWithResponse":"Microsoft.EdgeMarketplace.Offers.get","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.list":"Microsoft.EdgeMarketplace.Offers.list","com.azure.resourcemanager.edgemarketplace.fluent.OffersClient.listBySubscription":"Microsoft.EdgeMarketplace.Offers.listBySubscription","com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient":"Microsoft.EdgeMarketplace.Operations","com.azure.resourcemanager.edgemarketplace.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient":"Microsoft.EdgeMarketplace.Publishers","com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.get":"Microsoft.EdgeMarketplace.Publishers.get","com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.getWithResponse":"Microsoft.EdgeMarketplace.Publishers.get","com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.list":"Microsoft.EdgeMarketplace.Publishers.list","com.azure.resourcemanager.edgemarketplace.fluent.PublishersClient.listBySubscription":"Microsoft.EdgeMarketplace.Publishers.listBySubscription","com.azure.resourcemanager.edgemarketplace.fluent.models.DiskAccessTokenInner":"Microsoft.EdgeMarketplace.DiskAccessToken","com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner":"Microsoft.EdgeMarketplace.Offer","com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner":"Microsoft.EdgeMarketplace.Publisher","com.azure.resourcemanager.edgemarketplace.implementation.EdgeMarketplaceManagementClientBuilder":"Microsoft.EdgeMarketplace","com.azure.resourcemanager.edgemarketplace.implementation.models.OfferListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.edgemarketplace.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.edgemarketplace.implementation.models.PublisherListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest":"Microsoft.EdgeMarketplace.AccessTokenReadRequest","com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest":"Microsoft.EdgeMarketplace.AccessTokenRequest","com.azure.resourcemanager.edgemarketplace.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.edgemarketplace.models.IconFileUris":"Microsoft.EdgeMarketplace.IconFileUris","com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku":"Microsoft.EdgeMarketplace.MarketplaceSku","com.azure.resourcemanager.edgemarketplace.models.MarketplaceSkuVersion":"Microsoft.EdgeMarketplace.MarketplaceSkuVersion","com.azure.resourcemanager.edgemarketplace.models.OfferAvailability":"Microsoft.EdgeMarketplace.OfferAvailability","com.azure.resourcemanager.edgemarketplace.models.OfferContent":"Microsoft.EdgeMarketplace.OfferContent","com.azure.resourcemanager.edgemarketplace.models.OfferLaunchType":"Microsoft.EdgeMarketplace.OfferLaunchType","com.azure.resourcemanager.edgemarketplace.models.OfferProperties":"Microsoft.EdgeMarketplace.OfferProperties","com.azure.resourcemanager.edgemarketplace.models.OfferPublisher":"Microsoft.EdgeMarketplace.OfferPublisher","com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType":"Microsoft.EdgeMarketplace.OfferReleaseType","com.azure.resourcemanager.edgemarketplace.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.edgemarketplace.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.edgemarketplace.models.PublisherProperties":"Microsoft.EdgeMarketplace.PublisherProperties","com.azure.resourcemanager.edgemarketplace.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","com.azure.resourcemanager.edgemarketplace.models.SkuOperatingSystem":"Microsoft.EdgeMarketplace.SkuOperatingSystem","com.azure.resourcemanager.edgemarketplace.models.TermsAndConditions":"Microsoft.EdgeMarketplace.TermsAndConditions"},"generatedFiles":["src/main/java/com/azure/resourcemanager/edgemarketplace/EdgeMarketplaceManager.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/EdgeMarketplaceManagementClient.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OffersClient.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/PublishersClient.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/DiskAccessTokenInner.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OfferInner.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/PublisherInner.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/edgemarketplace/fluent/package-info.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/DiskAccessTokenImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/EdgeMarketplaceManagementClientImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OfferImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersClientImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OffersImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublisherImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersClientImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/PublishersImpl.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OfferListResult.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/models/PublisherListResult.java","src/main/java/com/azure/resourcemanager/edgemarketplace/implementation/package-info.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenReadRequest.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/AccessTokenRequest.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/ActionType.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/DiskAccessToken.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/IconFileUris.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSku.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/MarketplaceSkuVersion.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offer.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferAvailability.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferContent.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferLaunchType.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferProperties.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferPublisher.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OfferReleaseType.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Offers.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operation.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Operations.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Origin.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publisher.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/PublisherProperties.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/Publishers.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/ResourceProvisioningState.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/SkuOperatingSystem.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/TermsAndConditions.java","src/main/java/com/azure/resourcemanager/edgemarketplace/models/package-info.java","src/main/java/com/azure/resourcemanager/edgemarketplace/package-info.java","src/main/java/module-info.java"]} \ 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/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..86a272829120 --- /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.OffersClientImpl$OffersService"],["com.azure.resourcemanager.edgemarketplace.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.edgemarketplace.implementation.PublishersClientImpl$PublishersService"]] \ 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..0637a088a01e --- /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 @@ +[] \ No newline at end of file diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/azure-resourcemanager-edgemarketplace.properties b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/azure-resourcemanager-edgemarketplace.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/main/resources/azure-resourcemanager-edgemarketplace.properties @@ -0,0 +1 @@ +version=${project.version} 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..9a5e902ce3bc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGenerateAccessTokenSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec 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: 2025-10-01-preview/GenerateAccessToken.json + */ + /** + * Sample code: Offers_GenerateAccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void + offersGenerateAccessToken(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..40c4bda178e2 --- /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) TypeSpec 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: 2025-10-01-preview/GetAccessToken.json + */ + /** + * Sample code: Offers_GetAccessToken. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void offersGetAccessToken(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..23e43cd45890 --- /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) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Offers Get. + */ +public final class OffersGetSamples { + /* + * x-ms-original-file: 2025-10-01-preview/GetOffer.json + */ + /** + * Sample code: Offers_Get. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void offersGet(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..dabf2cbb0387 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Offers ListBySubscription. + */ +public final class OffersListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-10-01-preview/ListOffersBySubscription.json + */ + /** + * Sample code: Offers_ListBySubscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void + offersListBySubscription(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.offers().listBySubscription(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..e796e91ff000 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Offers List. + */ +public final class OffersListSamples { + /* + * x-ms-original-file: 2025-10-01-preview/ListOffers.json + */ + /** + * Sample code: Offers_List. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void offersList(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..31c0327e9afb --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-10-01-preview/ListOperations.json + */ + /** + * Sample code: Operations_List. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void operationsList(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..b83f47bc4be1 --- /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) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Publishers Get. + */ +public final class PublishersGetSamples { + /* + * x-ms-original-file: 2025-10-01-preview/GetPublisher.json + */ + /** + * Sample code: Publishers_Get. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void publishersGet(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..34a3c261f880 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Publishers ListBySubscription. + */ +public final class PublishersListBySubscriptionSamples { + /* + * x-ms-original-file: 2025-10-01-preview/ListPublishersBySubscription.json + */ + /** + * Sample code: Publishers_ListBySubscription. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void + publishersListBySubscription(com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager manager) { + manager.publishers().listBySubscription(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..41ca666dbd22 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/samples/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +/** + * Samples for Publishers List. + */ +public final class PublishersListSamples { + /* + * x-ms-original-file: 2025-10-01-preview/ListPublishers.json + */ + /** + * Sample code: Publishers_List. + * + * @param manager Entry point to EdgeMarketplaceManager. + */ + public static void publishersList(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/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/AccessTokenReadRequestTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/AccessTokenReadRequestTests.java new file mode 100644 index 000000000000..3df6044bbe31 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/AccessTokenReadRequestTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenReadRequest; +import org.junit.jupiter.api.Assertions; + +public final class AccessTokenReadRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccessTokenReadRequest model + = BinaryData.fromString("{\"requestId\":\"uhpigvp\"}").toObject(AccessTokenReadRequest.class); + Assertions.assertEquals("uhpigvp", model.requestId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccessTokenReadRequest model = new AccessTokenReadRequest().withRequestId("uhpigvp"); + model = BinaryData.fromObject(model).toObject(AccessTokenReadRequest.class); + Assertions.assertEquals("uhpigvp", model.requestId()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/AccessTokenRequestTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/AccessTokenRequestTests.java new file mode 100644 index 000000000000..c94fd5ad54a0 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/AccessTokenRequestTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.AccessTokenRequest; +import org.junit.jupiter.api.Assertions; + +public final class AccessTokenRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccessTokenRequest model = BinaryData.fromString( + "{\"publisherName\":\"sjyofdx\",\"edgeMarketPlaceRegion\":\"uusdttouwa\",\"egeMarketPlaceResourceId\":\"ekqvkeln\",\"hypervGeneration\":\"vbxwyjsflhh\",\"marketPlaceSku\":\"aln\",\"marketPlaceSkuVersion\":\"xisxyawjoyaqcsl\",\"deviceSku\":\"pkii\",\"deviceVersion\":\"yexz\"}") + .toObject(AccessTokenRequest.class); + Assertions.assertEquals("sjyofdx", model.publisherName()); + Assertions.assertEquals("uusdttouwa", model.edgeMarketPlaceRegion()); + Assertions.assertEquals("ekqvkeln", model.egeMarketPlaceResourceId()); + Assertions.assertEquals("vbxwyjsflhh", model.hypervGeneration()); + Assertions.assertEquals("aln", model.marketPlaceSku()); + Assertions.assertEquals("xisxyawjoyaqcsl", model.marketPlaceSkuVersion()); + Assertions.assertEquals("pkii", model.deviceSku()); + Assertions.assertEquals("yexz", model.deviceVersion()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccessTokenRequest model = new AccessTokenRequest().withPublisherName("sjyofdx") + .withEdgeMarketPlaceRegion("uusdttouwa") + .withEgeMarketPlaceResourceId("ekqvkeln") + .withHypervGeneration("vbxwyjsflhh") + .withMarketPlaceSku("aln") + .withMarketPlaceSkuVersion("xisxyawjoyaqcsl") + .withDeviceSku("pkii") + .withDeviceVersion("yexz"); + model = BinaryData.fromObject(model).toObject(AccessTokenRequest.class); + Assertions.assertEquals("sjyofdx", model.publisherName()); + Assertions.assertEquals("uusdttouwa", model.edgeMarketPlaceRegion()); + Assertions.assertEquals("ekqvkeln", model.egeMarketPlaceResourceId()); + Assertions.assertEquals("vbxwyjsflhh", model.hypervGeneration()); + Assertions.assertEquals("aln", model.marketPlaceSku()); + Assertions.assertEquals("xisxyawjoyaqcsl", model.marketPlaceSkuVersion()); + Assertions.assertEquals("pkii", model.deviceSku()); + Assertions.assertEquals("yexz", model.deviceVersion()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/IconFileUrisTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/IconFileUrisTests.java new file mode 100644 index 000000000000..7f523390d262 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/IconFileUrisTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.IconFileUris; +import org.junit.jupiter.api.Assertions; + +public final class IconFileUrisTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IconFileUris model = BinaryData + .fromString( + "{\"small\":\"vdfgiotk\",\"medium\":\"utqxlngx\",\"wide\":\"fgugnxkrxdqmid\",\"large\":\"hzrvqd\"}") + .toObject(IconFileUris.class); + Assertions.assertEquals("vdfgiotk", model.small()); + Assertions.assertEquals("utqxlngx", model.medium()); + Assertions.assertEquals("fgugnxkrxdqmid", model.wide()); + Assertions.assertEquals("hzrvqd", model.large()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/MarketplaceSkuTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/MarketplaceSkuTests.java new file mode 100644 index 000000000000..6248840ae8fa --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/MarketplaceSkuTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.MarketplaceSku; +import com.azure.resourcemanager.edgemarketplace.models.OfferLaunchType; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceSkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceSku model = BinaryData.fromString( + "{\"catalogPlanId\":\"nyktzlcuiy\",\"marketplaceSkuId\":\"gqywgndrv\",\"type\":\"hzgpphrcgyncocpe\",\"displayName\":\"vmmcoofs\",\"summary\":\"zevgb\",\"longSummary\":\"jqabcypmivkwlzuv\",\"description\":\"fwnfnb\",\"generation\":\"fionl\",\"displayRank\":10134075,\"operatingSystem\":{\"family\":\"qgtz\",\"type\":\"pnqbqqwxrjfe\",\"name\":\"llnwsubi\"},\"marketplaceSkuVersions\":[{\"name\":\"ampmngnz\",\"sizeOnDiskInMb\":1460212605,\"minimumDownloadSizeInMb\":431293436,\"stageName\":\"ooch\",\"launchType\":\"Trusted\"},{\"name\":\"nqvpkvlrxnje\",\"sizeOnDiskInMb\":1288725476,\"minimumDownloadSizeInMb\":625674029,\"stageName\":\"eo\",\"launchType\":\"Unknown\"},{\"name\":\"keyyi\",\"sizeOnDiskInMb\":1666003354,\"minimumDownloadSizeInMb\":290307035,\"stageName\":\"wtgrhpdjpj\",\"launchType\":\"Unknown\"},{\"name\":\"sxazjpq\",\"sizeOnDiskInMb\":973371108,\"minimumDownloadSizeInMb\":1267309720,\"stageName\":\"hb\",\"launchType\":\"Trusted\"}]}") + .toObject(MarketplaceSku.class); + Assertions.assertEquals("nyktzlcuiy", model.catalogPlanId()); + Assertions.assertEquals("gqywgndrv", model.marketplaceSkuId()); + Assertions.assertEquals("hzgpphrcgyncocpe", model.type()); + Assertions.assertEquals("vmmcoofs", model.displayName()); + Assertions.assertEquals("zevgb", model.summary()); + Assertions.assertEquals("jqabcypmivkwlzuv", model.longSummary()); + Assertions.assertEquals("fwnfnb", model.description()); + Assertions.assertEquals("fionl", model.generation()); + Assertions.assertEquals(10134075, model.displayRank()); + Assertions.assertEquals("qgtz", model.operatingSystem().family()); + Assertions.assertEquals("pnqbqqwxrjfe", model.operatingSystem().type()); + Assertions.assertEquals("llnwsubi", model.operatingSystem().name()); + Assertions.assertEquals("ampmngnz", model.marketplaceSkuVersions().get(0).name()); + Assertions.assertEquals(1460212605, model.marketplaceSkuVersions().get(0).sizeOnDiskInMb()); + Assertions.assertEquals(431293436, model.marketplaceSkuVersions().get(0).minimumDownloadSizeInMb()); + Assertions.assertEquals("ooch", model.marketplaceSkuVersions().get(0).stageName()); + Assertions.assertEquals(OfferLaunchType.TRUSTED, model.marketplaceSkuVersions().get(0).launchType()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/MarketplaceSkuVersionTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/MarketplaceSkuVersionTests.java new file mode 100644 index 000000000000..4459b918aa03 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/MarketplaceSkuVersionTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.MarketplaceSkuVersion; +import com.azure.resourcemanager.edgemarketplace.models.OfferLaunchType; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceSkuVersionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceSkuVersion model = BinaryData.fromString( + "{\"name\":\"wmc\",\"sizeOnDiskInMb\":1913635803,\"minimumDownloadSizeInMb\":1733107709,\"stageName\":\"jnpg\",\"launchType\":\"Unknown\"}") + .toObject(MarketplaceSkuVersion.class); + Assertions.assertEquals("wmc", model.name()); + Assertions.assertEquals(1913635803, model.sizeOnDiskInMb()); + Assertions.assertEquals(1733107709, model.minimumDownloadSizeInMb()); + Assertions.assertEquals("jnpg", model.stageName()); + Assertions.assertEquals(OfferLaunchType.UNKNOWN, model.launchType()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferContentTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferContentTests.java new file mode 100644 index 000000000000..5a41b077b286 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferContentTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferContent; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import org.junit.jupiter.api.Assertions; + +public final class OfferContentTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferContent model = BinaryData.fromString( + "{\"displayName\":\"ierhhbcsglummaj\",\"summary\":\"aodxo\",\"longSummary\":\"bdxkqpxokaj\",\"description\":\"npime\",\"offerId\":\"gstxgcp\",\"offerType\":\"gmaajrm\",\"supportUri\":\"jwzrl\",\"popularity\":725370714,\"offerPublisher\":{\"publisherId\":\"lwhijcoejctbzaq\",\"publisherDisplayName\":\"qsycbkbfkgu\"},\"availability\":\"Private\",\"releaseType\":\"Preview\",\"iconFileUris\":{\"small\":\"pofm\",\"medium\":\"x\",\"wide\":\"jpgd\",\"large\":\"ocjjxhvpmouexh\"},\"termsAndConditions\":{\"legalTermsUri\":\"i\",\"legalTermsType\":\"eojnxqbzvddn\",\"privacyPolicyUri\":\"ndei\"},\"categoryIds\":[\"w\",\"pzaoqvuhr\",\"cffcyddglmj\",\"hjq\"],\"operatingSystems\":[\"yeicxmqciwqvhk\",\"ixuigdtopbobj\"]}") + .toObject(OfferContent.class); + Assertions.assertEquals("ierhhbcsglummaj", model.displayName()); + Assertions.assertEquals("aodxo", model.summary()); + Assertions.assertEquals("bdxkqpxokaj", model.longSummary()); + Assertions.assertEquals("npime", model.description()); + Assertions.assertEquals("gstxgcp", model.offerId()); + Assertions.assertEquals("gmaajrm", model.offerType()); + Assertions.assertEquals("jwzrl", model.supportUri()); + Assertions.assertEquals(725370714, model.popularity()); + Assertions.assertEquals("lwhijcoejctbzaq", model.offerPublisher().publisherId()); + Assertions.assertEquals("qsycbkbfkgu", model.offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PRIVATE, model.availability()); + Assertions.assertEquals(OfferReleaseType.PREVIEW, model.releaseType()); + Assertions.assertEquals("pofm", model.iconFileUris().small()); + Assertions.assertEquals("x", model.iconFileUris().medium()); + Assertions.assertEquals("jpgd", model.iconFileUris().wide()); + Assertions.assertEquals("ocjjxhvpmouexh", model.iconFileUris().large()); + Assertions.assertEquals("i", model.termsAndConditions().legalTermsUri()); + Assertions.assertEquals("eojnxqbzvddn", model.termsAndConditions().legalTermsType()); + Assertions.assertEquals("ndei", model.termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("w", model.categoryIds().get(0)); + Assertions.assertEquals("yeicxmqciwqvhk", model.operatingSystems().get(0)); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferInnerTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferInnerTests.java new file mode 100644 index 000000000000..7560f9f89d8e --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferInnerTests.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OfferInner; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferLaunchType; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import org.junit.jupiter.api.Assertions; + +public final class OfferInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferInner model = BinaryData.fromString( + "{\"properties\":{\"contentVersion\":\"jbpzvgnwzsymg\",\"contentUrl\":\"uf\",\"offerContent\":{\"displayName\":\"yzkohdbihanuf\",\"summary\":\"cbjy\",\"longSummary\":\"git\",\"description\":\"qhabifpikxwcz\",\"offerId\":\"yscnpqxu\",\"offerType\":\"vyq\",\"supportUri\":\"wby\",\"popularity\":143848779,\"offerPublisher\":{\"publisherId\":\"vd\",\"publisherDisplayName\":\"mjgr\"},\"availability\":\"Private\",\"releaseType\":\"Preview\",\"iconFileUris\":{\"small\":\"gaudcc\",\"medium\":\"h\",\"wide\":\"cnyejhkryhtnapcz\",\"large\":\"okjye\"},\"termsAndConditions\":{\"legalTermsUri\":\"vnipjox\",\"legalTermsType\":\"nchgej\",\"privacyPolicyUri\":\"odmailzyd\"},\"categoryIds\":[\"jwyahuxinpmqnja\"],\"operatingSystems\":[\"xj\",\"prozvcputegjvwmf\",\"atscmd\",\"pjhulsuuvmkj\"]},\"provisioningState\":\"Succeeded\",\"marketplaceSkus\":[{\"catalogPlanId\":\"f\",\"marketplaceSkuId\":\"dio\",\"type\":\"pslwejdpvw\",\"displayName\":\"oqpsoa\",\"summary\":\"tazak\",\"longSummary\":\"lahbcryff\",\"description\":\"dosyg\",\"generation\":\"paojakhmsbzjh\",\"displayRank\":1969349443,\"operatingSystem\":{\"family\":\"dphlxaolt\",\"type\":\"trg\",\"name\":\"jbp\"},\"marketplaceSkuVersions\":[{\"name\":\"s\",\"sizeOnDiskInMb\":96730142,\"minimumDownloadSizeInMb\":57043753,\"stageName\":\"cjrwzoxxjtfellu\",\"launchType\":\"Unknown\"},{\"name\":\"it\",\"sizeOnDiskInMb\":180815183,\"minimumDownloadSizeInMb\":1181425969,\"stageName\":\"pjkjlxofpdv\",\"launchType\":\"Unknown\"},{\"name\":\"xxypininmay\",\"sizeOnDiskInMb\":731267721,\"minimumDownloadSizeInMb\":1439394091,\"stageName\":\"podepoo\",\"launchType\":\"Unknown\"},{\"name\":\"uvamiheognarxzxt\",\"sizeOnDiskInMb\":222575453,\"minimumDownloadSizeInMb\":1544576839,\"stageName\":\"ivyevcciqihnhun\",\"launchType\":\"Unknown\"}]},{\"catalogPlanId\":\"jzrnf\",\"marketplaceSkuId\":\"gxg\",\"type\":\"pemvtzfkufubljof\",\"displayName\":\"eofjaeqjh\",\"summary\":\"b\",\"longSummary\":\"v\",\"description\":\"mjqulngsn\",\"generation\":\"bybkzgcwrwclxx\",\"displayRank\":1729632043,\"operatingSystem\":{\"family\":\"ouskcqvkocrc\",\"type\":\"kwt\",\"name\":\"hxbnjbiksqrg\"},\"marketplaceSkuVersions\":[{\"name\":\"ainqpjwnzlljfm\",\"sizeOnDiskInMb\":450622751,\"minimumDownloadSizeInMb\":2010421384,\"stageName\":\"mgxsab\",\"launchType\":\"Unknown\"},{\"name\":\"duuji\",\"sizeOnDiskInMb\":315440352,\"minimumDownloadSizeInMb\":1939991929,\"stageName\":\"zevndhkrwpdappds\",\"launchType\":\"Unknown\"},{\"name\":\"vwrwj\",\"sizeOnDiskInMb\":2141844336,\"minimumDownloadSizeInMb\":1882901501,\"stageName\":\"utjeltmrldhugj\",\"launchType\":\"Unknown\"}]},{\"catalogPlanId\":\"atqxho\",\"marketplaceSkuId\":\"dgeablgphu\",\"type\":\"cndvkaozwyiftyhx\",\"displayName\":\"rokft\",\"summary\":\"olniwpwcukjf\",\"longSummary\":\"iawxklry\",\"description\":\"wckbasyypnd\",\"generation\":\"sgcbac\",\"displayRank\":750414718,\"operatingSystem\":{\"family\":\"ot\",\"type\":\"qgoulznd\",\"name\":\"i\"},\"marketplaceSkuVersions\":[{\"name\":\"qkgfgibma\",\"sizeOnDiskInMb\":1288567604,\"minimumDownloadSizeInMb\":1720928556,\"stageName\":\"s\",\"launchType\":\"Trusted\"},{\"name\":\"bzqqedqytbciq\",\"sizeOnDiskInMb\":1245187453,\"minimumDownloadSizeInMb\":1485441711,\"stageName\":\"mnkzsmod\",\"launchType\":\"Trusted\"}]}]},\"id\":\"ugpbkw\",\"name\":\"mutduqktaps\",\"type\":\"wgcu\"}") + .toObject(OfferInner.class); + Assertions.assertEquals("jbpzvgnwzsymg", model.properties().contentVersion()); + Assertions.assertEquals("uf", model.properties().contentUrl()); + Assertions.assertEquals("yzkohdbihanuf", model.properties().offerContent().displayName()); + Assertions.assertEquals("cbjy", model.properties().offerContent().summary()); + Assertions.assertEquals("git", model.properties().offerContent().longSummary()); + Assertions.assertEquals("qhabifpikxwcz", model.properties().offerContent().description()); + Assertions.assertEquals("yscnpqxu", model.properties().offerContent().offerId()); + Assertions.assertEquals("vyq", model.properties().offerContent().offerType()); + Assertions.assertEquals("wby", model.properties().offerContent().supportUri()); + Assertions.assertEquals(143848779, model.properties().offerContent().popularity()); + Assertions.assertEquals("vd", model.properties().offerContent().offerPublisher().publisherId()); + Assertions.assertEquals("mjgr", model.properties().offerContent().offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PRIVATE, model.properties().offerContent().availability()); + Assertions.assertEquals(OfferReleaseType.PREVIEW, model.properties().offerContent().releaseType()); + Assertions.assertEquals("gaudcc", model.properties().offerContent().iconFileUris().small()); + Assertions.assertEquals("h", model.properties().offerContent().iconFileUris().medium()); + Assertions.assertEquals("cnyejhkryhtnapcz", model.properties().offerContent().iconFileUris().wide()); + Assertions.assertEquals("okjye", model.properties().offerContent().iconFileUris().large()); + Assertions.assertEquals("vnipjox", model.properties().offerContent().termsAndConditions().legalTermsUri()); + Assertions.assertEquals("nchgej", model.properties().offerContent().termsAndConditions().legalTermsType()); + Assertions.assertEquals("odmailzyd", model.properties().offerContent().termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("jwyahuxinpmqnja", model.properties().offerContent().categoryIds().get(0)); + Assertions.assertEquals("xj", model.properties().offerContent().operatingSystems().get(0)); + Assertions.assertEquals("f", model.properties().marketplaceSkus().get(0).catalogPlanId()); + Assertions.assertEquals("dio", model.properties().marketplaceSkus().get(0).marketplaceSkuId()); + Assertions.assertEquals("pslwejdpvw", model.properties().marketplaceSkus().get(0).type()); + Assertions.assertEquals("oqpsoa", model.properties().marketplaceSkus().get(0).displayName()); + Assertions.assertEquals("tazak", model.properties().marketplaceSkus().get(0).summary()); + Assertions.assertEquals("lahbcryff", model.properties().marketplaceSkus().get(0).longSummary()); + Assertions.assertEquals("dosyg", model.properties().marketplaceSkus().get(0).description()); + Assertions.assertEquals("paojakhmsbzjh", model.properties().marketplaceSkus().get(0).generation()); + Assertions.assertEquals(1969349443, model.properties().marketplaceSkus().get(0).displayRank()); + Assertions.assertEquals("dphlxaolt", model.properties().marketplaceSkus().get(0).operatingSystem().family()); + Assertions.assertEquals("trg", model.properties().marketplaceSkus().get(0).operatingSystem().type()); + Assertions.assertEquals("jbp", model.properties().marketplaceSkus().get(0).operatingSystem().name()); + Assertions.assertEquals("s", + model.properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).name()); + Assertions.assertEquals(96730142, + model.properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).sizeOnDiskInMb()); + Assertions.assertEquals(57043753, + model.properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).minimumDownloadSizeInMb()); + Assertions.assertEquals("cjrwzoxxjtfellu", + model.properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).stageName()); + Assertions.assertEquals(OfferLaunchType.UNKNOWN, + model.properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).launchType()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferListResultTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferListResultTests.java new file mode 100644 index 000000000000..45e66177b4f3 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferListResultTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.implementation.models.OfferListResult; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import org.junit.jupiter.api.Assertions; + +public final class OfferListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"contentVersion\":\"ehxnltyfsop\",\"contentUrl\":\"suesnzw\",\"offerContent\":{\"displayName\":\"ej\",\"summary\":\"vorxzdmohct\",\"longSummary\":\"vudwx\",\"description\":\"dnvowg\",\"offerId\":\"jjugwdkcglhslaz\",\"offerType\":\"yggdtjixh\",\"supportUri\":\"uofqwe\",\"popularity\":1965159297,\"offerPublisher\":{\"publisherId\":\"enevfyexfwhybci\",\"publisherDisplayName\":\"vyvdcs\"},\"availability\":\"Private\",\"releaseType\":\"Preview\",\"iconFileUris\":{\"small\":\"mdectehfiqscjey\",\"medium\":\"hezrkgq\",\"wide\":\"jrefovgmkqsle\",\"large\":\"vxyqjpkcattpngjc\"},\"termsAndConditions\":{\"legalTermsUri\":\"zsqpjhvmdajvny\",\"legalTermsType\":\"unqecanoae\",\"privacyPolicyUri\":\"fhyhltrpmopjmcma\"},\"categoryIds\":[\"kthfui\"],\"operatingSystems\":[\"dsfcpkvxodpuoz\",\"yzydagfuaxbezyi\",\"okktwhrdxw\",\"ywqsmbsurexim\"]},\"provisioningState\":\"Succeeded\",\"marketplaceSkus\":[{\"catalogPlanId\":\"fsfksymddyst\",\"marketplaceSkuId\":\"i\",\"type\":\"xhqyudxorrqnb\",\"displayName\":\"czvyifq\",\"summary\":\"kdvjsll\",\"longSummary\":\"vvdfwatkpnpul\",\"description\":\"xbczwtruwiqz\",\"generation\":\"j\",\"displayRank\":668778225,\"operatingSystem\":{\"name\":\"myokacspkwlh\"},\"marketplaceSkuVersions\":[{\"name\":\"bpxjmfl\"},{\"name\":\"vvnchrkcc\"},{\"name\":\"wwzjuqkhrsajiwku\"}]}]},\"id\":\"oskg\",\"name\":\"sauuimj\",\"type\":\"vxieduugidyj\"},{\"properties\":{\"contentVersion\":\"byao\",\"contentUrl\":\"e\",\"offerContent\":{\"displayName\":\"csonpclhoco\",\"summary\":\"lkevle\",\"longSummary\":\"zfbuhf\",\"description\":\"faxkffeii\",\"offerId\":\"hl\",\"offerType\":\"ez\",\"supportUri\":\"shxmzsbbzoggigrx\",\"popularity\":285101547,\"offerPublisher\":{\"publisherId\":\"vjxxjnsp\",\"publisherDisplayName\":\"dptkoenkouk\"},\"availability\":\"Public\",\"releaseType\":\"GA\",\"iconFileUris\":{\"small\":\"ukbldngkpo\",\"medium\":\"pazyxoegukg\",\"wide\":\"piu\",\"large\":\"ygevqzntypmrbpiz\"},\"termsAndConditions\":{\"legalTermsUri\":\"qjsdpydnfyhxdeo\",\"legalTermsType\":\"zi\",\"privacyPolicyUri\":\"ifsjttgzfbishcb\"},\"categoryIds\":[\"jdeyeamdpha\",\"alpbuxwgipwhon\",\"wkgshwa\",\"kix\"],\"operatingSystems\":[\"njeputtmrywn\",\"zoqftiyqzrnkcqvy\"]},\"provisioningState\":\"Canceled\",\"marketplaceSkus\":[{\"catalogPlanId\":\"lsicohoqqnwv\",\"marketplaceSkuId\":\"ryavwhheunmmqh\",\"type\":\"xzko\",\"displayName\":\"cukoklyaxuconu\",\"summary\":\"zf\",\"longSummary\":\"eyp\",\"description\":\"rmjmwvvjektc\",\"generation\":\"enhwlrs\",\"displayRank\":1160903159,\"operatingSystem\":{\"name\":\"pwvlqdq\"},\"marketplaceSkuVersions\":[{\"name\":\"qylihkaetckt\"},{\"name\":\"fcivfsnkym\"},{\"name\":\"ctq\"}]},{\"catalogPlanId\":\"jf\",\"marketplaceSkuId\":\"ebrjcxe\",\"type\":\"uwutttxfvjrbi\",\"displayName\":\"hxepcyvahfnlj\",\"summary\":\"qxj\",\"longSummary\":\"ujqgidok\",\"description\":\"ljyoxgvcltb\",\"generation\":\"ncghkje\",\"displayRank\":279046587,\"operatingSystem\":{\"name\":\"bijhtxfvgxbf\"},\"marketplaceSkuVersions\":[{\"name\":\"nehmpvecx\"},{\"name\":\"odebfqkkrbmpu\"},{\"name\":\"gr\"}]}]},\"id\":\"flz\",\"name\":\"fbxzpuzycisp\",\"type\":\"qzahmgkbrp\"},{\"properties\":{\"contentVersion\":\"hibnuqqkpika\",\"contentUrl\":\"gvtqagnbuynh\",\"offerContent\":{\"displayName\":\"jggmebfsiarbu\",\"summary\":\"cvpnazzmhjrunmpx\",\"longSummary\":\"dbhrbnlankxm\",\"description\":\"k\",\"offerId\":\"bhenbtkcxywnyt\",\"offerType\":\"synlqidybyxczfc\",\"supportUri\":\"aaxdbabphlwrq\",\"popularity\":1096564755,\"offerPublisher\":{\"publisherId\":\"sthsu\",\"publisherDisplayName\":\"ocmnyyazttbtwwrq\"},\"availability\":\"Public\",\"releaseType\":\"GA\",\"iconFileUris\":{\"small\":\"ywbiexzfeyueax\",\"medium\":\"xujwbhqwalmuzyo\",\"wide\":\"epdkzja\",\"large\":\"ux\"},\"termsAndConditions\":{\"legalTermsUri\":\"wbavxbniwdj\",\"legalTermsType\":\"zt\",\"privacyPolicyUri\":\"bpg\"},\"categoryIds\":[\"txhp\",\"xbzpfzab\"],\"operatingSystems\":[\"uhxwtctyqiklbbov\"]},\"provisioningState\":\"Failed\",\"marketplaceSkus\":[{\"catalogPlanId\":\"hvgyuguosvmk\",\"marketplaceSkuId\":\"ss\",\"type\":\"ukkfplgmgs\",\"displayName\":\"kjz\",\"summary\":\"es\",\"longSummary\":\"vlopwiyighx\",\"description\":\"dwzbaiue\",\"generation\":\"a\",\"displayRank\":1617320432,\"operatingSystem\":{\"name\":\"qupedeojnab\"},\"marketplaceSkuVersions\":[{\"name\":\"smtxpsieb\"},{\"name\":\"fhvpesaps\"},{\"name\":\"rdqmhjjdhtldwkyz\"},{\"name\":\"uutkncw\"}]},{\"catalogPlanId\":\"cwsvlxotog\",\"marketplaceSkuId\":\"wrupqsxvnmicykvc\",\"type\":\"vei\",\"displayName\":\"vnotyfjfcnj\",\"summary\":\"cn\",\"longSummary\":\"hbttkphyw\",\"description\":\"vjtoqnermclfp\",\"generation\":\"hoxus\",\"displayRank\":2041952882,\"operatingSystem\":{\"name\":\"bgyepsbj\"},\"marketplaceSkuVersions\":[{\"name\":\"qugxywpmueefjzwf\"}]}]},\"id\":\"q\",\"name\":\"jidsuyonobglaoc\",\"type\":\"xtccmg\"},{\"properties\":{\"contentVersion\":\"xy\",\"contentUrl\":\"moyrxvwfudwpz\",\"offerContent\":{\"displayName\":\"txhdzh\",\"summary\":\"qj\",\"longSummary\":\"ck\",\"description\":\"lhrxsbkyvpyc\",\"offerId\":\"n\",\"offerType\":\"bpzkafkuwbc\",\"supportUri\":\"wbme\",\"popularity\":1198251199,\"offerPublisher\":{\"publisherId\":\"yvjusrtslhsp\",\"publisherDisplayName\":\"deemao\"},\"availability\":\"Public\",\"releaseType\":\"GA\",\"iconFileUris\":{\"small\":\"t\",\"medium\":\"lmqkrhahvlj\",\"wide\":\"haquhcdh\",\"large\":\"ualaexqpvfadmw\"},\"termsAndConditions\":{\"legalTermsUri\":\"r\",\"legalTermsType\":\"xpvgo\",\"privacyPolicyUri\":\"lf\"},\"categoryIds\":[\"gwb\",\"b\",\"e\"],\"operatingSystems\":[\"wkz\"]},\"provisioningState\":\"Failed\",\"marketplaceSkus\":[{\"catalogPlanId\":\"urqhaka\",\"marketplaceSkuId\":\"hashsfwxosow\",\"type\":\"cugicjoox\",\"displayName\":\"ebwpucwwfvo\",\"summary\":\"vmeueci\",\"longSummary\":\"hzceuojgjrwjue\",\"description\":\"twm\",\"generation\":\"ytdxwit\",\"displayRank\":1070997174,\"operatingSystem\":{\"name\":\"awgqwgxhni\"},\"marketplaceSkuVersions\":[{\"name\":\"fbkp\"}]},{\"catalogPlanId\":\"cg\",\"marketplaceSkuId\":\"lwn\",\"type\":\"hjdauwhvylwz\",\"displayName\":\"dhxujznbmpo\",\"summary\":\"wpr\",\"longSummary\":\"lve\",\"description\":\"lupj\",\"generation\":\"hfxobbcswsrtj\",\"displayRank\":946074368,\"operatingSystem\":{\"name\":\"rbpbewtghfgblcg\"},\"marketplaceSkuVersions\":[{\"name\":\"vlvqhjkbegi\"},{\"name\":\"t\"},{\"name\":\"mxiebw\"},{\"name\":\"aloayqcgwrtzju\"}]},{\"catalogPlanId\":\"gwyzm\",\"marketplaceSkuId\":\"txon\",\"type\":\"ts\",\"displayName\":\"jcbpwxqpsrknft\",\"summary\":\"vriuhprwmdyvx\",\"longSummary\":\"ayriwwroyqbexrm\",\"description\":\"ibycno\",\"generation\":\"knme\",\"displayRank\":1391032405,\"operatingSystem\":{\"name\":\"zvahapjy\"},\"marketplaceSkuVersions\":[{\"name\":\"vgqzcjrvxd\"},{\"name\":\"zlmwlxkvugfhz\"},{\"name\":\"vawjvzunlu\"},{\"name\":\"hnnpr\"}]}]},\"id\":\"i\",\"name\":\"eilpjzuaejxdu\",\"type\":\"tskzbbtdzumveek\"}],\"nextLink\":\"wozuhkf\"}") + .toObject(OfferListResult.class); + Assertions.assertEquals("ehxnltyfsop", model.value().get(0).properties().contentVersion()); + Assertions.assertEquals("suesnzw", model.value().get(0).properties().contentUrl()); + Assertions.assertEquals("ej", model.value().get(0).properties().offerContent().displayName()); + Assertions.assertEquals("vorxzdmohct", model.value().get(0).properties().offerContent().summary()); + Assertions.assertEquals("vudwx", model.value().get(0).properties().offerContent().longSummary()); + Assertions.assertEquals("dnvowg", model.value().get(0).properties().offerContent().description()); + Assertions.assertEquals("jjugwdkcglhslaz", model.value().get(0).properties().offerContent().offerId()); + Assertions.assertEquals("yggdtjixh", model.value().get(0).properties().offerContent().offerType()); + Assertions.assertEquals("uofqwe", model.value().get(0).properties().offerContent().supportUri()); + Assertions.assertEquals(1965159297, model.value().get(0).properties().offerContent().popularity()); + Assertions.assertEquals("enevfyexfwhybci", + model.value().get(0).properties().offerContent().offerPublisher().publisherId()); + Assertions.assertEquals("vyvdcs", + model.value().get(0).properties().offerContent().offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PRIVATE, + model.value().get(0).properties().offerContent().availability()); + Assertions.assertEquals(OfferReleaseType.PREVIEW, + model.value().get(0).properties().offerContent().releaseType()); + Assertions.assertEquals("mdectehfiqscjey", + model.value().get(0).properties().offerContent().iconFileUris().small()); + Assertions.assertEquals("hezrkgq", model.value().get(0).properties().offerContent().iconFileUris().medium()); + Assertions.assertEquals("jrefovgmkqsle", + model.value().get(0).properties().offerContent().iconFileUris().wide()); + Assertions.assertEquals("vxyqjpkcattpngjc", + model.value().get(0).properties().offerContent().iconFileUris().large()); + Assertions.assertEquals("zsqpjhvmdajvny", + model.value().get(0).properties().offerContent().termsAndConditions().legalTermsUri()); + Assertions.assertEquals("unqecanoae", + model.value().get(0).properties().offerContent().termsAndConditions().legalTermsType()); + Assertions.assertEquals("fhyhltrpmopjmcma", + model.value().get(0).properties().offerContent().termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("kthfui", model.value().get(0).properties().offerContent().categoryIds().get(0)); + Assertions.assertEquals("dsfcpkvxodpuoz", + model.value().get(0).properties().offerContent().operatingSystems().get(0)); + Assertions.assertEquals("fsfksymddyst", + model.value().get(0).properties().marketplaceSkus().get(0).catalogPlanId()); + Assertions.assertEquals("i", model.value().get(0).properties().marketplaceSkus().get(0).marketplaceSkuId()); + Assertions.assertEquals("xhqyudxorrqnb", model.value().get(0).properties().marketplaceSkus().get(0).type()); + Assertions.assertEquals("czvyifq", model.value().get(0).properties().marketplaceSkus().get(0).displayName()); + Assertions.assertEquals("kdvjsll", model.value().get(0).properties().marketplaceSkus().get(0).summary()); + Assertions.assertEquals("vvdfwatkpnpul", + model.value().get(0).properties().marketplaceSkus().get(0).longSummary()); + Assertions.assertEquals("xbczwtruwiqz", + model.value().get(0).properties().marketplaceSkus().get(0).description()); + Assertions.assertEquals("j", model.value().get(0).properties().marketplaceSkus().get(0).generation()); + Assertions.assertEquals(668778225, model.value().get(0).properties().marketplaceSkus().get(0).displayRank()); + Assertions.assertEquals("myokacspkwlh", + model.value().get(0).properties().marketplaceSkus().get(0).operatingSystem().name()); + Assertions.assertEquals("bpxjmfl", + model.value().get(0).properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).name()); + Assertions.assertEquals("wozuhkf", model.nextLink()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferPropertiesTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferPropertiesTests.java new file mode 100644 index 000000000000..54f25d24740c --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferPropertiesTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferLaunchType; +import com.azure.resourcemanager.edgemarketplace.models.OfferProperties; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import org.junit.jupiter.api.Assertions; + +public final class OfferPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferProperties model = BinaryData.fromString( + "{\"contentVersion\":\"tumkdosvqwhbm\",\"contentUrl\":\"bbjfddgmbmbexp\",\"offerContent\":{\"displayName\":\"bhtqqrolfpfpsa\",\"summary\":\"bquxigjy\",\"longSummary\":\"zjaoyfhrtxil\",\"description\":\"rkujy\",\"offerId\":\"vlejuvfqa\",\"offerType\":\"lyxwjkcprbnwbx\",\"supportUri\":\"vtb\",\"popularity\":1198925267,\"offerPublisher\":{\"publisherId\":\"szdnr\",\"publisherDisplayName\":\"jq\"},\"availability\":\"Public\",\"releaseType\":\"Preview\",\"iconFileUris\":{\"small\":\"qfprwzwbn\",\"medium\":\"itnwuizgazxufi\",\"wide\":\"ckyfih\",\"large\":\"idf\"},\"termsAndConditions\":{\"legalTermsUri\":\"dzuhtymwi\",\"legalTermsType\":\"kfthwxmntei\",\"privacyPolicyUri\":\"opvkmijcm\"},\"categoryIds\":[\"cufufsrpymz\"],\"operatingSystems\":[\"sezcxtb\"]},\"provisioningState\":\"Succeeded\",\"marketplaceSkus\":[{\"catalogPlanId\":\"c\",\"marketplaceSkuId\":\"sne\",\"type\":\"dwzjeiach\",\"displayName\":\"osfln\",\"summary\":\"sfqpteehz\",\"longSummary\":\"ypyqrimzinp\",\"description\":\"wjdk\",\"generation\":\"soodqxhcrmnoh\",\"displayRank\":1543175438,\"operatingSystem\":{\"family\":\"h\",\"type\":\"oifiyipjxsqwpgr\",\"name\":\"bznorcjxvsnby\"},\"marketplaceSkuVersions\":[{\"name\":\"bnmo\",\"sizeOnDiskInMb\":1668091107,\"minimumDownloadSizeInMb\":1982146580,\"stageName\":\"urzafb\",\"launchType\":\"Trusted\"},{\"name\":\"gpbtoqcjmklj\",\"sizeOnDiskInMb\":1963237214,\"minimumDownloadSizeInMb\":62975440,\"stageName\":\"tqajzyulpkudjkrl\",\"launchType\":\"Unknown\"},{\"name\":\"z\",\"sizeOnDiskInMb\":194307867,\"minimumDownloadSizeInMb\":98964950,\"stageName\":\"gqexzlocxs\",\"launchType\":\"Trusted\"}]}]}") + .toObject(OfferProperties.class); + Assertions.assertEquals("tumkdosvqwhbm", model.contentVersion()); + Assertions.assertEquals("bbjfddgmbmbexp", model.contentUrl()); + Assertions.assertEquals("bhtqqrolfpfpsa", model.offerContent().displayName()); + Assertions.assertEquals("bquxigjy", model.offerContent().summary()); + Assertions.assertEquals("zjaoyfhrtxil", model.offerContent().longSummary()); + Assertions.assertEquals("rkujy", model.offerContent().description()); + Assertions.assertEquals("vlejuvfqa", model.offerContent().offerId()); + Assertions.assertEquals("lyxwjkcprbnwbx", model.offerContent().offerType()); + Assertions.assertEquals("vtb", model.offerContent().supportUri()); + Assertions.assertEquals(1198925267, model.offerContent().popularity()); + Assertions.assertEquals("szdnr", model.offerContent().offerPublisher().publisherId()); + Assertions.assertEquals("jq", model.offerContent().offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PUBLIC, model.offerContent().availability()); + Assertions.assertEquals(OfferReleaseType.PREVIEW, model.offerContent().releaseType()); + Assertions.assertEquals("qfprwzwbn", model.offerContent().iconFileUris().small()); + Assertions.assertEquals("itnwuizgazxufi", model.offerContent().iconFileUris().medium()); + Assertions.assertEquals("ckyfih", model.offerContent().iconFileUris().wide()); + Assertions.assertEquals("idf", model.offerContent().iconFileUris().large()); + Assertions.assertEquals("dzuhtymwi", model.offerContent().termsAndConditions().legalTermsUri()); + Assertions.assertEquals("kfthwxmntei", model.offerContent().termsAndConditions().legalTermsType()); + Assertions.assertEquals("opvkmijcm", model.offerContent().termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("cufufsrpymz", model.offerContent().categoryIds().get(0)); + Assertions.assertEquals("sezcxtb", model.offerContent().operatingSystems().get(0)); + Assertions.assertEquals("c", model.marketplaceSkus().get(0).catalogPlanId()); + Assertions.assertEquals("sne", model.marketplaceSkus().get(0).marketplaceSkuId()); + Assertions.assertEquals("dwzjeiach", model.marketplaceSkus().get(0).type()); + Assertions.assertEquals("osfln", model.marketplaceSkus().get(0).displayName()); + Assertions.assertEquals("sfqpteehz", model.marketplaceSkus().get(0).summary()); + Assertions.assertEquals("ypyqrimzinp", model.marketplaceSkus().get(0).longSummary()); + Assertions.assertEquals("wjdk", model.marketplaceSkus().get(0).description()); + Assertions.assertEquals("soodqxhcrmnoh", model.marketplaceSkus().get(0).generation()); + Assertions.assertEquals(1543175438, model.marketplaceSkus().get(0).displayRank()); + Assertions.assertEquals("h", model.marketplaceSkus().get(0).operatingSystem().family()); + Assertions.assertEquals("oifiyipjxsqwpgr", model.marketplaceSkus().get(0).operatingSystem().type()); + Assertions.assertEquals("bznorcjxvsnby", model.marketplaceSkus().get(0).operatingSystem().name()); + Assertions.assertEquals("bnmo", model.marketplaceSkus().get(0).marketplaceSkuVersions().get(0).name()); + Assertions.assertEquals(1668091107, + model.marketplaceSkus().get(0).marketplaceSkuVersions().get(0).sizeOnDiskInMb()); + Assertions.assertEquals(1982146580, + model.marketplaceSkus().get(0).marketplaceSkuVersions().get(0).minimumDownloadSizeInMb()); + Assertions.assertEquals("urzafb", model.marketplaceSkus().get(0).marketplaceSkuVersions().get(0).stageName()); + Assertions.assertEquals(OfferLaunchType.TRUSTED, + model.marketplaceSkus().get(0).marketplaceSkuVersions().get(0).launchType()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferPublisherTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferPublisherTests.java new file mode 100644 index 000000000000..634bc5bbf3a1 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OfferPublisherTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.OfferPublisher; +import org.junit.jupiter.api.Assertions; + +public final class OfferPublisherTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferPublisher model + = BinaryData.fromString("{\"publisherId\":\"ghmewuam\",\"publisherDisplayName\":\"uhrzayvvt\"}") + .toObject(OfferPublisher.class); + Assertions.assertEquals("ghmewuam", model.publisherId()); + Assertions.assertEquals("uhrzayvvt", model.publisherDisplayName()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetWithResponseMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetWithResponseMockTests.java new file mode 100644 index 000000000000..2c34e8cb45cc --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersGetWithResponseMockTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Offer; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OffersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"contentVersion\":\"qtdo\",\"contentUrl\":\"cbxvwvxyslqbh\",\"offerContent\":{\"displayName\":\"fxoblytkb\",\"summary\":\"pe\",\"longSummary\":\"wfbkrvrns\",\"description\":\"hqjohxcrsbfova\",\"offerId\":\"rruvwbhsq\",\"offerType\":\"ubcgjbirxb\",\"supportUri\":\"bsrfbj\",\"popularity\":837542479,\"offerPublisher\":{\"publisherId\":\"ssotftpv\",\"publisherDisplayName\":\"zbexilzznfqqnvw\"},\"availability\":\"Public\",\"releaseType\":\"GA\",\"iconFileUris\":{\"small\":\"oujmkcjhwqytj\",\"medium\":\"bnw\",\"wide\":\"wgdrjervnaenqp\",\"large\":\"indoygmifthnzd\"},\"termsAndConditions\":{\"legalTermsUri\":\"l\",\"legalTermsType\":\"ayqigynduhav\",\"privacyPolicyUri\":\"lkthu\"},\"categoryIds\":[\"olbgycduiertgccy\",\"vaolpsslqlf\"],\"operatingSystems\":[\"n\",\"bglzpswi\",\"d\"]},\"provisioningState\":\"Failed\",\"marketplaceSkus\":[{\"catalogPlanId\":\"zdxss\",\"marketplaceSkuId\":\"dbzm\",\"type\":\"dfznudaodv\",\"displayName\":\"bncblylpstdbhhx\",\"summary\":\"zdzucerscdntnevf\",\"longSummary\":\"jmygtdsslswtmwer\",\"description\":\"fzp\",\"generation\":\"semwabnet\",\"displayRank\":1149443455,\"operatingSystem\":{\"family\":\"h\",\"type\":\"plvwiwubmwmbes\",\"name\":\"dnkwwtppjflcxog\"},\"marketplaceSkuVersions\":[{\"name\":\"onz\"},{\"name\":\"nsikvmkqzeqqkdl\"},{\"name\":\"fzxmhhvhgureodkw\"}]},{\"catalogPlanId\":\"bdagxt\",\"marketplaceSkuId\":\"bqdxbx\",\"type\":\"kbogqxndlkzgx\",\"displayName\":\"ripl\",\"summary\":\"odxun\",\"longSummary\":\"ebxmubyynt\",\"description\":\"rbqtkoie\",\"generation\":\"eotg\",\"displayRank\":209864806,\"operatingSystem\":{\"family\":\"muwlauwzizxbm\",\"type\":\"cjefuzmu\",\"name\":\"pbttdum\"},\"marketplaceSkuVersions\":[{\"name\":\"pxebmnzbt\"}]},{\"catalogPlanId\":\"hjpglkf\",\"marketplaceSkuId\":\"ohdneuel\",\"type\":\"hsd\",\"displayName\":\"t\",\"summary\":\"fikdowwqu\",\"longSummary\":\"xzxcl\",\"description\":\"thhqzonosggbh\",\"generation\":\"hfwdsjnkaljutiis\",\"displayRank\":559440936,\"operatingSystem\":{\"family\":\"gdkz\",\"type\":\"wkfvhqcrailvp\",\"name\":\"ppfufl\"},\"marketplaceSkuVersions\":[{\"name\":\"mh\"},{\"name\":\"lxyjr\"},{\"name\":\"sag\"}]}]},\"id\":\"cnihgwqapnedgfbc\",\"name\":\"kcvqvpke\",\"type\":\"dcvd\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Offer response + = manager.offers().getWithResponse("szjfauvjfdxxivet", "t", com.azure.core.util.Context.NONE).getValue(); + + Assertions.assertEquals("qtdo", response.properties().contentVersion()); + Assertions.assertEquals("cbxvwvxyslqbh", response.properties().contentUrl()); + Assertions.assertEquals("fxoblytkb", response.properties().offerContent().displayName()); + Assertions.assertEquals("pe", response.properties().offerContent().summary()); + Assertions.assertEquals("wfbkrvrns", response.properties().offerContent().longSummary()); + Assertions.assertEquals("hqjohxcrsbfova", response.properties().offerContent().description()); + Assertions.assertEquals("rruvwbhsq", response.properties().offerContent().offerId()); + Assertions.assertEquals("ubcgjbirxb", response.properties().offerContent().offerType()); + Assertions.assertEquals("bsrfbj", response.properties().offerContent().supportUri()); + Assertions.assertEquals(837542479, response.properties().offerContent().popularity()); + Assertions.assertEquals("ssotftpv", response.properties().offerContent().offerPublisher().publisherId()); + Assertions.assertEquals("zbexilzznfqqnvw", + response.properties().offerContent().offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PUBLIC, response.properties().offerContent().availability()); + Assertions.assertEquals(OfferReleaseType.GA, response.properties().offerContent().releaseType()); + Assertions.assertEquals("oujmkcjhwqytj", response.properties().offerContent().iconFileUris().small()); + Assertions.assertEquals("bnw", response.properties().offerContent().iconFileUris().medium()); + Assertions.assertEquals("wgdrjervnaenqp", response.properties().offerContent().iconFileUris().wide()); + Assertions.assertEquals("indoygmifthnzd", response.properties().offerContent().iconFileUris().large()); + Assertions.assertEquals("l", response.properties().offerContent().termsAndConditions().legalTermsUri()); + Assertions.assertEquals("ayqigynduhav", + response.properties().offerContent().termsAndConditions().legalTermsType()); + Assertions.assertEquals("lkthu", response.properties().offerContent().termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("olbgycduiertgccy", response.properties().offerContent().categoryIds().get(0)); + Assertions.assertEquals("n", response.properties().offerContent().operatingSystems().get(0)); + Assertions.assertEquals("zdxss", response.properties().marketplaceSkus().get(0).catalogPlanId()); + Assertions.assertEquals("dbzm", response.properties().marketplaceSkus().get(0).marketplaceSkuId()); + Assertions.assertEquals("dfznudaodv", response.properties().marketplaceSkus().get(0).type()); + Assertions.assertEquals("bncblylpstdbhhx", response.properties().marketplaceSkus().get(0).displayName()); + Assertions.assertEquals("zdzucerscdntnevf", response.properties().marketplaceSkus().get(0).summary()); + Assertions.assertEquals("jmygtdsslswtmwer", response.properties().marketplaceSkus().get(0).longSummary()); + Assertions.assertEquals("fzp", response.properties().marketplaceSkus().get(0).description()); + Assertions.assertEquals("semwabnet", response.properties().marketplaceSkus().get(0).generation()); + Assertions.assertEquals(1149443455, response.properties().marketplaceSkus().get(0).displayRank()); + Assertions.assertEquals("h", response.properties().marketplaceSkus().get(0).operatingSystem().family()); + Assertions.assertEquals("plvwiwubmwmbes", + response.properties().marketplaceSkus().get(0).operatingSystem().type()); + Assertions.assertEquals("dnkwwtppjflcxog", + response.properties().marketplaceSkus().get(0).operatingSystem().name()); + Assertions.assertEquals("onz", + response.properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).name()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionMockTests.java new file mode 100644 index 000000000000..e137ff0ae58f --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListBySubscriptionMockTests.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Offer; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OffersListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"contentVersion\":\"gymare\",\"contentUrl\":\"ajxq\",\"offerContent\":{\"displayName\":\"gjhkycubeddg\",\"summary\":\"ofwq\",\"longSummary\":\"qal\",\"description\":\"mnjijpxacqqudf\",\"offerId\":\"byxbaaabjy\",\"offerType\":\"yffimrzrtuzqogs\",\"supportUri\":\"nevfdnw\",\"popularity\":2059840008,\"offerPublisher\":{\"publisherId\":\"wzsyyceuzs\",\"publisherDisplayName\":\"i\"},\"availability\":\"Private\",\"releaseType\":\"GA\",\"iconFileUris\":{\"small\":\"xtrthz\",\"medium\":\"ytdw\",\"wide\":\"brqubp\",\"large\":\"h\"},\"termsAndConditions\":{\"legalTermsUri\":\"i\",\"legalTermsType\":\"vpdtiirqtdqoa\",\"privacyPolicyUri\":\"r\"},\"categoryIds\":[\"gsquyfxrxxlept\",\"amxjezwlw\"],\"operatingSystems\":[\"uqlcvydy\",\"atdooaojkniod\",\"oo\"]},\"provisioningState\":\"Canceled\",\"marketplaceSkus\":[{\"catalogPlanId\":\"jhemms\",\"marketplaceSkuId\":\"vdkcrodtj\",\"type\":\"fw\",\"displayName\":\"fltkacjv\",\"summary\":\"kdlfoa\",\"longSummary\":\"gkfpaga\",\"description\":\"pulpqblylsyxk\",\"generation\":\"nsj\",\"displayRank\":560645314,\"operatingSystem\":{\"family\":\"agxsdszuemps\",\"type\":\"kfzbeyvpnqicvi\",\"name\":\"v\"},\"marketplaceSkuVersions\":[{\"name\":\"xdxr\"},{\"name\":\"uukzclewyhmlw\"},{\"name\":\"aztz\"}]},{\"catalogPlanId\":\"ofncckwyfzqwhxxb\",\"marketplaceSkuId\":\"yq\",\"type\":\"zfeqztppri\",\"displayName\":\"xorjaltolmncwsob\",\"summary\":\"csdbnwdcfhuc\",\"longSummary\":\"pfuvglsbjjca\",\"description\":\"xbvtvudu\",\"generation\":\"cormr\",\"displayRank\":1360670450,\"operatingSystem\":{\"family\":\"cofudflvkgjub\",\"type\":\"knnqvsaznq\",\"name\":\"tor\"},\"marketplaceSkuVersions\":[{\"name\":\"gsahmkycgrauw\"},{\"name\":\"uetae\"},{\"name\":\"uruv\"}]},{\"catalogPlanId\":\"movsmzlxwabmqoe\",\"marketplaceSkuId\":\"kif\",\"type\":\"tpuqujmq\",\"displayName\":\"kfbtndoaongbjc\",\"summary\":\"ujitcjedftww\",\"longSummary\":\"zkoj\",\"description\":\"c\",\"generation\":\"foqouicybx\",\"displayRank\":490438503,\"operatingSystem\":{\"family\":\"zuf\",\"type\":\"ciqopidoa\",\"name\":\"ciodhkhaz\"},\"marketplaceSkuVersions\":[{\"name\":\"nz\"},{\"name\":\"onlwntoeg\"}]},{\"catalogPlanId\":\"kdwbwhkszz\",\"marketplaceSkuId\":\"mrv\",\"type\":\"ztvbtqgsfr\",\"displayName\":\"yzkoowtlmngu\",\"summary\":\"wqaldsyu\",\"longSummary\":\"imerqfobwyznk\",\"description\":\"kutwpf\",\"generation\":\"a\",\"displayRank\":71172193,\"operatingSystem\":{\"family\":\"kdsnfdsdoakgtdl\",\"type\":\"kzevdlhewpusds\",\"name\":\"twvogvbbe\"},\"marketplaceSkuVersions\":[{\"name\":\"ngqqmoakuf\"},{\"name\":\"m\"},{\"name\":\"zr\"},{\"name\":\"rdgrtw\"}]}]},\"id\":\"nuuzkopbm\",\"name\":\"nrfdw\",\"type\":\"yuhhziu\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.offers().listBySubscription(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("gymare", response.iterator().next().properties().contentVersion()); + Assertions.assertEquals("ajxq", response.iterator().next().properties().contentUrl()); + Assertions.assertEquals("gjhkycubeddg", response.iterator().next().properties().offerContent().displayName()); + Assertions.assertEquals("ofwq", response.iterator().next().properties().offerContent().summary()); + Assertions.assertEquals("qal", response.iterator().next().properties().offerContent().longSummary()); + Assertions.assertEquals("mnjijpxacqqudf", response.iterator().next().properties().offerContent().description()); + Assertions.assertEquals("byxbaaabjy", response.iterator().next().properties().offerContent().offerId()); + Assertions.assertEquals("yffimrzrtuzqogs", response.iterator().next().properties().offerContent().offerType()); + Assertions.assertEquals("nevfdnw", response.iterator().next().properties().offerContent().supportUri()); + Assertions.assertEquals(2059840008, response.iterator().next().properties().offerContent().popularity()); + Assertions.assertEquals("wzsyyceuzs", + response.iterator().next().properties().offerContent().offerPublisher().publisherId()); + Assertions.assertEquals("i", + response.iterator().next().properties().offerContent().offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PRIVATE, + response.iterator().next().properties().offerContent().availability()); + Assertions.assertEquals(OfferReleaseType.GA, + response.iterator().next().properties().offerContent().releaseType()); + Assertions.assertEquals("xtrthz", + response.iterator().next().properties().offerContent().iconFileUris().small()); + Assertions.assertEquals("ytdw", response.iterator().next().properties().offerContent().iconFileUris().medium()); + Assertions.assertEquals("brqubp", response.iterator().next().properties().offerContent().iconFileUris().wide()); + Assertions.assertEquals("h", response.iterator().next().properties().offerContent().iconFileUris().large()); + Assertions.assertEquals("i", + response.iterator().next().properties().offerContent().termsAndConditions().legalTermsUri()); + Assertions.assertEquals("vpdtiirqtdqoa", + response.iterator().next().properties().offerContent().termsAndConditions().legalTermsType()); + Assertions.assertEquals("r", + response.iterator().next().properties().offerContent().termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("gsquyfxrxxlept", + response.iterator().next().properties().offerContent().categoryIds().get(0)); + Assertions.assertEquals("uqlcvydy", + response.iterator().next().properties().offerContent().operatingSystems().get(0)); + Assertions.assertEquals("jhemms", + response.iterator().next().properties().marketplaceSkus().get(0).catalogPlanId()); + Assertions.assertEquals("vdkcrodtj", + response.iterator().next().properties().marketplaceSkus().get(0).marketplaceSkuId()); + Assertions.assertEquals("fw", response.iterator().next().properties().marketplaceSkus().get(0).type()); + Assertions.assertEquals("fltkacjv", + response.iterator().next().properties().marketplaceSkus().get(0).displayName()); + Assertions.assertEquals("kdlfoa", response.iterator().next().properties().marketplaceSkus().get(0).summary()); + Assertions.assertEquals("gkfpaga", + response.iterator().next().properties().marketplaceSkus().get(0).longSummary()); + Assertions.assertEquals("pulpqblylsyxk", + response.iterator().next().properties().marketplaceSkus().get(0).description()); + Assertions.assertEquals("nsj", response.iterator().next().properties().marketplaceSkus().get(0).generation()); + Assertions.assertEquals(560645314, + response.iterator().next().properties().marketplaceSkus().get(0).displayRank()); + Assertions.assertEquals("agxsdszuemps", + response.iterator().next().properties().marketplaceSkus().get(0).operatingSystem().family()); + Assertions.assertEquals("kfzbeyvpnqicvi", + response.iterator().next().properties().marketplaceSkus().get(0).operatingSystem().type()); + Assertions.assertEquals("v", + response.iterator().next().properties().marketplaceSkus().get(0).operatingSystem().name()); + Assertions.assertEquals("xdxr", + response.iterator().next().properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).name()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListMockTests.java new file mode 100644 index 000000000000..3119a37985f4 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OffersListMockTests.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Offer; +import com.azure.resourcemanager.edgemarketplace.models.OfferAvailability; +import com.azure.resourcemanager.edgemarketplace.models.OfferReleaseType; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OffersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"contentVersion\":\"uoegrpkhjwniyqs\",\"contentUrl\":\"i\",\"offerContent\":{\"displayName\":\"pdggkzzlvm\",\"summary\":\"paxmodfvuefywsb\",\"longSummary\":\"vmwy\",\"description\":\"fouyf\",\"offerId\":\"aakc\",\"offerType\":\"iyzvqtmnub\",\"supportUri\":\"kpzksmondjmq\",\"popularity\":1083170526,\"offerPublisher\":{\"publisherId\":\"pomgkopkwhojvp\",\"publisherDisplayName\":\"jqg\"},\"availability\":\"Private\",\"releaseType\":\"GA\",\"iconFileUris\":{\"small\":\"bq\",\"medium\":\"vmkcx\",\"wide\":\"apvhelxprgly\",\"large\":\"dd\"},\"termsAndConditions\":{\"legalTermsUri\":\"bcuejrjxgci\",\"legalTermsType\":\"brh\",\"privacyPolicyUri\":\"xsdqrhzoymibmrqy\"},\"categoryIds\":[\"hwflu\",\"zdtmhrkwofy\",\"voqacpiexpbt\",\"iwbwoenwashrtdtk\"],\"operatingSystems\":[\"xwbpokulpiuj\",\"aasipqi\",\"obyu\"]},\"provisioningState\":\"Succeeded\",\"marketplaceSkus\":[{\"catalogPlanId\":\"lp\",\"marketplaceSkuId\":\"wcciuqgbdbu\",\"type\":\"uvfbtkuwh\",\"displayName\":\"hykojoxafnndlpic\",\"summary\":\"o\",\"longSummary\":\"kcdyhbpk\",\"description\":\"wdreqnovvqfovl\",\"generation\":\"ywsuwsy\",\"displayRank\":200190444,\"operatingSystem\":{\"family\":\"ytgadgvraeaene\",\"type\":\"zar\",\"name\":\"wlquuijfqkace\"},\"marketplaceSkuVersions\":[{\"name\":\"pfpubjibww\"},{\"name\":\"f\"}]},{\"catalogPlanId\":\"ohqkvpuvksgpls\",\"marketplaceSkuId\":\"kn\",\"type\":\"fsynljphuop\",\"displayName\":\"dlqiyntorzih\",\"summary\":\"osjswsr\",\"longSummary\":\"lyzrpzbchckqqzqi\",\"description\":\"iysui\",\"generation\":\"ynkedyatrwyhqmib\",\"displayRank\":891981372,\"operatingSystem\":{\"family\":\"tsmypyynpcdp\",\"type\":\"nzgmwznmabik\",\"name\":\"sorgj\"},\"marketplaceSkuVersions\":[{\"name\":\"ldtlwwr\"},{\"name\":\"kdmtncvokotll\"}]},{\"catalogPlanId\":\"d\",\"marketplaceSkuId\":\"h\",\"type\":\"y\",\"displayName\":\"ogjltdtbnnhad\",\"summary\":\"crkvcikhnv\",\"longSummary\":\"mqg\",\"description\":\"queziky\",\"generation\":\"gxk\",\"displayRank\":395512854,\"operatingSystem\":{\"family\":\"melwuipiccjz\",\"type\":\"ivgvvcna\",\"name\":\"rhyrnxxmueed\"},\"marketplaceSkuVersions\":[{\"name\":\"dvstkw\"},{\"name\":\"qtc\"},{\"name\":\"ealmfmtdaaygdvwv\"}]}]},\"id\":\"iohgwxrtfud\",\"name\":\"epxgyqagvr\",\"type\":\"mnpkukghimdblxg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.offers() + .list("hvoodsotbobzd", 1257406932, 1146790818, 118794160, "wvnhdldwmgx", "xrslpm", + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("uoegrpkhjwniyqs", response.iterator().next().properties().contentVersion()); + Assertions.assertEquals("i", response.iterator().next().properties().contentUrl()); + Assertions.assertEquals("pdggkzzlvm", response.iterator().next().properties().offerContent().displayName()); + Assertions.assertEquals("paxmodfvuefywsb", response.iterator().next().properties().offerContent().summary()); + Assertions.assertEquals("vmwy", response.iterator().next().properties().offerContent().longSummary()); + Assertions.assertEquals("fouyf", response.iterator().next().properties().offerContent().description()); + Assertions.assertEquals("aakc", response.iterator().next().properties().offerContent().offerId()); + Assertions.assertEquals("iyzvqtmnub", response.iterator().next().properties().offerContent().offerType()); + Assertions.assertEquals("kpzksmondjmq", response.iterator().next().properties().offerContent().supportUri()); + Assertions.assertEquals(1083170526, response.iterator().next().properties().offerContent().popularity()); + Assertions.assertEquals("pomgkopkwhojvp", + response.iterator().next().properties().offerContent().offerPublisher().publisherId()); + Assertions.assertEquals("jqg", + response.iterator().next().properties().offerContent().offerPublisher().publisherDisplayName()); + Assertions.assertEquals(OfferAvailability.PRIVATE, + response.iterator().next().properties().offerContent().availability()); + Assertions.assertEquals(OfferReleaseType.GA, + response.iterator().next().properties().offerContent().releaseType()); + Assertions.assertEquals("bq", response.iterator().next().properties().offerContent().iconFileUris().small()); + Assertions.assertEquals("vmkcx", + response.iterator().next().properties().offerContent().iconFileUris().medium()); + Assertions.assertEquals("apvhelxprgly", + response.iterator().next().properties().offerContent().iconFileUris().wide()); + Assertions.assertEquals("dd", response.iterator().next().properties().offerContent().iconFileUris().large()); + Assertions.assertEquals("bcuejrjxgci", + response.iterator().next().properties().offerContent().termsAndConditions().legalTermsUri()); + Assertions.assertEquals("brh", + response.iterator().next().properties().offerContent().termsAndConditions().legalTermsType()); + Assertions.assertEquals("xsdqrhzoymibmrqy", + response.iterator().next().properties().offerContent().termsAndConditions().privacyPolicyUri()); + Assertions.assertEquals("hwflu", response.iterator().next().properties().offerContent().categoryIds().get(0)); + Assertions.assertEquals("xwbpokulpiuj", + response.iterator().next().properties().offerContent().operatingSystems().get(0)); + Assertions.assertEquals("lp", response.iterator().next().properties().marketplaceSkus().get(0).catalogPlanId()); + Assertions.assertEquals("wcciuqgbdbu", + response.iterator().next().properties().marketplaceSkus().get(0).marketplaceSkuId()); + Assertions.assertEquals("uvfbtkuwh", response.iterator().next().properties().marketplaceSkus().get(0).type()); + Assertions.assertEquals("hykojoxafnndlpic", + response.iterator().next().properties().marketplaceSkus().get(0).displayName()); + Assertions.assertEquals("o", response.iterator().next().properties().marketplaceSkus().get(0).summary()); + Assertions.assertEquals("kcdyhbpk", + response.iterator().next().properties().marketplaceSkus().get(0).longSummary()); + Assertions.assertEquals("wdreqnovvqfovl", + response.iterator().next().properties().marketplaceSkus().get(0).description()); + Assertions.assertEquals("ywsuwsy", + response.iterator().next().properties().marketplaceSkus().get(0).generation()); + Assertions.assertEquals(200190444, + response.iterator().next().properties().marketplaceSkus().get(0).displayRank()); + Assertions.assertEquals("ytgadgvraeaene", + response.iterator().next().properties().marketplaceSkus().get(0).operatingSystem().family()); + Assertions.assertEquals("zar", + response.iterator().next().properties().marketplaceSkus().get(0).operatingSystem().type()); + Assertions.assertEquals("wlquuijfqkace", + response.iterator().next().properties().marketplaceSkus().get(0).operatingSystem().name()); + Assertions.assertEquals("pfpubjibww", + response.iterator().next().properties().marketplaceSkus().get(0).marketplaceSkuVersions().get(0).name()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationDisplayTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..8e85faf0e893 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationInnerTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationInnerTests.java new file mode 100644 index 000000000000..fc4b33049378 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationListResultTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationListResultTests.java new file mode 100644 index 000000000000..b5cdadac3c61 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..c776fd87ea32 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"hzxct\",\"isDataAction\":true,\"display\":{\"provider\":\"dmoizpostmg\",\"resource\":\"fbunrmfqjhhk\",\"operation\":\"pvjymjhxxjyng\",\"description\":\"ivkrtsw\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherInnerTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherInnerTests.java new file mode 100644 index 000000000000..e9db2b2d5c4c --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.fluent.models.PublisherInner; + +public final class PublisherInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PublisherInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"git\",\"name\":\"medjvcslynqwwncw\",\"type\":\"zhxgktrmgucn\"}") + .toObject(PublisherInner.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherListResultTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherListResultTests.java new file mode 100644 index 000000000000..4d5a5a1e130f --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.implementation.models.PublisherListResult; +import org.junit.jupiter.api.Assertions; + +public final class PublisherListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PublisherListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"id\":\"lwptfdy\",\"name\":\"pfqbuaceopzf\",\"type\":\"rhhuaopppcqeqx\"}],\"nextLink\":\"z\"}") + .toObject(PublisherListResult.class); + Assertions.assertEquals("z", model.nextLink()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherPropertiesTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherPropertiesTests.java new file mode 100644 index 000000000000..380cede59f2a --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublisherPropertiesTests.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.PublisherProperties; + +public final class PublisherPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PublisherProperties model + = BinaryData.fromString("{\"provisioningState\":\"Canceled\"}").toObject(PublisherProperties.class); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersGetWithResponseMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersGetWithResponseMockTests.java new file mode 100644 index 000000000000..6819d7d0ad42 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersGetWithResponseMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Publisher; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PublishersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Failed\"},\"id\":\"ft\",\"name\":\"maequiahxicslfa\",\"type\":\"qzpiyyl\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Publisher response + = manager.publishers().getWithResponse("efozbhdms", "l", com.azure.core.util.Context.NONE).getValue(); + + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionMockTests.java new file mode 100644 index 000000000000..f3f232245a9d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListBySubscriptionMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Publisher; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PublishersListBySubscriptionMockTests { + @Test + public void testListBySubscription() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\"},\"id\":\"sdtclusiypbs\",\"name\":\"gytguslfead\",\"type\":\"ygqukyhejh\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.publishers().listBySubscription(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListMockTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListMockTests.java new file mode 100644 index 000000000000..4cfc166ea66d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/PublishersListMockTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.edgemarketplace.EdgeMarketplaceManager; +import com.azure.resourcemanager.edgemarketplace.models.Publisher; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PublishersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"id\":\"wmsweypqwd\",\"name\":\"ggicccnxqhue\",\"type\":\"mkttlstvlzywem\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + EdgeMarketplaceManager manager = EdgeMarketplaceManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.publishers() + .list("alnswhccsphk", 1331736876, 185919180, 2029124466, "itqscywuggwoluhc", "bwemhairs", + com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/SkuOperatingSystemTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/SkuOperatingSystemTests.java new file mode 100644 index 000000000000..cae169998628 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/SkuOperatingSystemTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.SkuOperatingSystem; +import org.junit.jupiter.api.Assertions; + +public final class SkuOperatingSystemTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SkuOperatingSystem model = BinaryData.fromString("{\"family\":\"jj\",\"type\":\"v\",\"name\":\"udgwdslfho\"}") + .toObject(SkuOperatingSystem.class); + Assertions.assertEquals("jj", model.family()); + Assertions.assertEquals("v", model.type()); + Assertions.assertEquals("udgwdslfho", model.name()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/TermsAndConditionsTests.java b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/TermsAndConditionsTests.java new file mode 100644 index 000000000000..75e018d20247 --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/src/test/java/com/azure/resourcemanager/edgemarketplace/generated/TermsAndConditionsTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.edgemarketplace.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.edgemarketplace.models.TermsAndConditions; +import org.junit.jupiter.api.Assertions; + +public final class TermsAndConditionsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TermsAndConditions model = BinaryData + .fromString("{\"legalTermsUri\":\"bhj\",\"legalTermsType\":\"igeho\",\"privacyPolicyUri\":\"bowsk\"}") + .toObject(TermsAndConditions.class); + Assertions.assertEquals("bhj", model.legalTermsUri()); + Assertions.assertEquals("igeho", model.legalTermsType()); + Assertions.assertEquals("bowsk", model.privacyPolicyUri()); + } +} diff --git a/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/tsp-location.yaml b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/tsp-location.yaml new file mode 100644 index 000000000000..269eb5c2a22d --- /dev/null +++ b/sdk/edgemarketplace/azure-resourcemanager-edgemarketplace/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/edgemarketplace/Microsoft.EdgeMarketPlace.Management +commit: f52764d11d53276b79bbbba37f977ef0b03bbd2c +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/edgemarketplace/ci.yml b/sdk/edgemarketplace/ci.yml new file mode 100644 index 000000000000..411195b17b5c --- /dev/null +++ b/sdk/edgemarketplace/ci.yml @@ -0,0 +1,46 @@ +# 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 + 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 + +