diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 7a7e7dcec0aad..0f5d9e9e6e806 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -468,6 +468,7 @@ com.azure.resourcemanager:azure-resourcemanager-containerorchestratorruntime;1.0 com.azure.resourcemanager:azure-resourcemanager-terraform;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-connectedcache;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-neonpostgres;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-pineconevectordb;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 io.clientcore:clientcore-parent;1.0.0-beta.1;1.0.0-beta.1 diff --git a/pom.xml b/pom.xml index b2a53dd56d553..f5498ce9b2869 100644 --- a/pom.xml +++ b/pom.xml @@ -163,6 +163,7 @@ sdk/parents sdk/peering sdk/personalizer + sdk/pineconevectordb sdk/playwrighttesting sdk/policyinsights sdk/postgresql diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/CHANGELOG.md b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/CHANGELOG.md new file mode 100644 index 0000000000000..ec3effcc650b3 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0-beta.1 (2025-01-23) + +- Azure Resource Manager Pinecone Vector Db client library for Java. This package contains Microsoft Azure SDK for Pinecone Vector Db Management SDK. 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-pineconevectordb Java SDK. diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/README.md b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/README.md new file mode 100644 index 0000000000000..ef8f46a1f8270 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/README.md @@ -0,0 +1,104 @@ +# Azure Resource Manager Pinecone Vector Db client library for Java + +Azure Resource Manager Pinecone Vector Db client library for Java. + +This package contains Microsoft Azure SDK for Pinecone Vector Db Management SDK. 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-pineconevectordb;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-pineconevectordb + 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(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PineconeVectorDbManager manager = PineconeVectorDbManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/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/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fpineconevectordb%2Fazure-resourcemanager-pineconevectordb%2FREADME.png) diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/SAMPLE.md b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/SAMPLE.md new file mode 100644 index 0000000000000..9d15a00b21f52 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/SAMPLE.md @@ -0,0 +1,262 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## Organizations + +- [CreateOrUpdate](#organizations_createorupdate) +- [Delete](#organizations_delete) +- [GetByResourceGroup](#organizations_getbyresourcegroup) +- [List](#organizations_list) +- [ListByResourceGroup](#organizations_listbyresourcegroup) +- [Update](#organizations_update) +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + operationsListMinimumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2024-10-22-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + operationsListMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_CreateOrUpdate + +```java +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.MarketplaceDetails; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import com.azure.resourcemanager.pineconevectordb.models.PartnerProperties; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnPropertiesV2; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import com.azure.resourcemanager.pineconevectordb.models.UserDetails; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations CreateOrUpdate. + */ +public final class OrganizationsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void organizationsCreateOrUpdateMaximumSet( + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations() + .define("example-organization-name") + .withRegion("us-east") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("my-tag", "tag.value")) + .withProperties(new OrganizationProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("76a38ef6-c8c1-4f0d-bfe0-00ec782c8077") + .withOfferDetails(new OfferDetails().withPublisherId("4d194daf-fa20-46a8-bfb4-5b7d96cae009") + .withOfferId("013124d0-bf05-4eab-a6bb-01fa83870642") + .withPlanId("62dda065-5acd-4ac5-b418-8610beed92a2") + .withPlanName("Freemium") + .withTermUnit("der") + .withTermId("a2b7ce01-f06d-4874-9f77-6ea4a4875c16"))) + .withUser(new UserDetails().withFirstName("Jimmy") + .withLastName("McExample") + .withEmailAddress("example.user@example.com") + .withUpn("example.user@example.com") + .withPhoneNumber("555-555-5555")) + .withPartnerProperties(new PartnerProperties().withDisplayName("My Example Organization")) + .withSingleSignOnProperties(new SingleSignOnPropertiesV2().withType(SingleSignOnType.SAML) + .withState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("44d3fb26-d8d5-41ff-9b9a-769737f22f13") + .withUrl("https://login.pinecone.io/?sso=true&connection=dfwgsqzkbrjqrglcsa") + .withAadDomains(Arrays.asList("exampledomain")))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("ident904655400", new UserAssignedIdentity()))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Organizations_Delete + +```java +/** + * Samples for Organizations Delete. + */ +public final class OrganizationsDeleteSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Delete_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + organizationsDeleteMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations().delete("rgopenapi", "example-organization-name", com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_GetByResourceGroup + +```java +/** + * Samples for Organizations GetByResourceGroup. + */ +public final class OrganizationsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Get_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + organizationsGetMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations() + .getByResourceGroupWithResponse("rgopenapi", "example-organization-name", com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_List + +```java +/** + * Samples for Organizations List. + */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListBySubscription_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void organizationsListBySubscriptionMaximumSet( + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_ListByResourceGroup + +```java +/** + * Samples for Organizations ListByResourceGroup. + */ +public final class OrganizationsListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void organizationsListByResourceGroupMaximumSet( + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_Update + +```java +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations Update. + */ +public final class OrganizationsUpdateSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Update_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + organizationsUpdateMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + OrganizationResource resource = manager.organizations() + .getByResourceGroupWithResponse("rgopenapi", "example-organization-name", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("new-tag", "new.tag.value")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("ident573739201", new UserAssignedIdentity()))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/pom.xml b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/pom.xml new file mode 100644 index 0000000000000..92bde6a9bd218 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/pom.xml @@ -0,0 +1,75 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-pineconevectordb + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Pinecone Vector Db Management + This package contains Microsoft Azure SDK for Pinecone Vector Db Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. + 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 + false + + + + com.azure + azure-core + 1.54.1 + + + com.azure + azure-core-management + 1.15.6 + + + com.azure + azure-core-test + 1.27.0-beta.4 + test + + + com.azure + azure-identity + 1.15.0 + test + + + diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/PineconeVectorDbManager.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/PineconeVectorDbManager.java new file mode 100644 index 0000000000000..44446d4898d76 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/PineconeVectorDbManager.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb; + +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.logging.ClientLogger; +import com.azure.resourcemanager.pineconevectordb.fluent.PineconeVectorDbMgmtClient; +import com.azure.resourcemanager.pineconevectordb.implementation.OperationsImpl; +import com.azure.resourcemanager.pineconevectordb.implementation.OrganizationsImpl; +import com.azure.resourcemanager.pineconevectordb.implementation.PineconeVectorDbMgmtClientBuilder; +import com.azure.resourcemanager.pineconevectordb.models.Operations; +import com.azure.resourcemanager.pineconevectordb.models.Organizations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to PineconeVectorDbManager. + */ +public final class PineconeVectorDbManager { + private Operations operations; + + private Organizations organizations; + + private final PineconeVectorDbMgmtClient clientObject; + + private PineconeVectorDbManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new PineconeVectorDbMgmtClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Pinecone Vector Db service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Pinecone Vector Db service API instance. + */ + public static PineconeVectorDbManager 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 Pinecone Vector Db service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Pinecone Vector Db service API instance. + */ + public static PineconeVectorDbManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new PineconeVectorDbManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create PineconeVectorDbManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PineconeVectorDbManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Pinecone Vector Db service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Pinecone Vector Db service API instance. + */ + public PineconeVectorDbManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.pineconevectordb") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new 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 PineconeVectorDbManager(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 Organizations. It manages OrganizationResource. + * + * @return Resource collection API of Organizations. + */ + public Organizations organizations() { + if (this.organizations == null) { + this.organizations = new OrganizationsImpl(clientObject.getOrganizations(), this); + } + return organizations; + } + + /** + * Gets wrapped service client PineconeVectorDbMgmtClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client PineconeVectorDbMgmtClient. + */ + public PineconeVectorDbMgmtClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/OperationsClient.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/OperationsClient.java new file mode 100644 index 0000000000000..32d290e70a3db --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/OrganizationsClient.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/OrganizationsClient.java new file mode 100644 index 0000000000000..ab04f51f437e8 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/OrganizationsClient.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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.pineconevectordb.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResourceUpdate; + +/** + * An instance of this class provides access to all the operations defined in OrganizationsClient. + */ +public interface OrganizationsClient { + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String organizationname, Context context); + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 a OrganizationResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner getByResourceGroup(String resourceGroupName, String organizationname); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrganizationResourceInner> + beginCreateOrUpdate(String resourceGroupName, String organizationname, OrganizationResourceInner resource); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @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 concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, OrganizationResourceInner> beginCreateOrUpdate( + String resourceGroupName, String organizationname, OrganizationResourceInner resource, Context context); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationname, + OrganizationResourceInner resource); + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationname, + OrganizationResourceInner resource, Context context); + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String organizationname, + OrganizationResourceUpdate properties, Context context); + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OrganizationResourceInner update(String resourceGroupName, String organizationname, + OrganizationResourceUpdate properties); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String organizationname); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String organizationname, Context context); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String organizationname); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String organizationname, Context context); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/PineconeVectorDbMgmtClient.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/PineconeVectorDbMgmtClient.java new file mode 100644 index 0000000000000..a41629233d7f4 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/PineconeVectorDbMgmtClient.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for PineconeVectorDbMgmtClient class. + */ +public interface PineconeVectorDbMgmtClient { + /** + * 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 OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + OrganizationsClient getOrganizations(); +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/OperationInner.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..22bd6ee3756d1 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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.pineconevectordb.models.ActionType; +import com.azure.resourcemanager.pineconevectordb.models.OperationDisplay; +import com.azure.resourcemanager.pineconevectordb.models.Origin; +import java.io.IOException; + +/** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/OrganizationResourceInner.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/OrganizationResourceInner.java new file mode 100644 index 0000000000000..b291e07b355a5 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/OrganizationResourceInner.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Concrete tracked resource types can be created by aliasing this type using a specific property type. + */ +@Fluent +public final class OrganizationResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private OrganizationProperties properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of OrganizationResourceInner class. + */ + public OrganizationResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public OrganizationProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withProperties(OrganizationProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public OrganizationResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public OrganizationResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OrganizationResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrganizationResourceInner 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 OrganizationResourceInner. + */ + public static OrganizationResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OrganizationResourceInner deserializedOrganizationResourceInner = new OrganizationResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedOrganizationResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedOrganizationResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedOrganizationResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedOrganizationResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedOrganizationResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedOrganizationResourceInner.properties = OrganizationProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedOrganizationResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedOrganizationResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOrganizationResourceInner; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/package-info.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/package-info.java new file mode 100644 index 0000000000000..a70d5cc3d8f79 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/models/package-info.java @@ -0,0 +1,8 @@ +// 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 PineconeVectorDb. + */ +package com.azure.resourcemanager.pineconevectordb.fluent.models; diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/package-info.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/package-info.java new file mode 100644 index 0000000000000..36d997db9912d --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/fluent/package-info.java @@ -0,0 +1,8 @@ +// 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 PineconeVectorDb. + */ +package com.azure.resourcemanager.pineconevectordb.fluent; diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationImpl.java new file mode 100644 index 0000000000000..196eb5fd73779 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.implementation; + +import com.azure.resourcemanager.pineconevectordb.fluent.models.OperationInner; +import com.azure.resourcemanager.pineconevectordb.models.ActionType; +import com.azure.resourcemanager.pineconevectordb.models.Operation; +import com.azure.resourcemanager.pineconevectordb.models.OperationDisplay; +import com.azure.resourcemanager.pineconevectordb.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager 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.pineconevectordb.PineconeVectorDbManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationsClientImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..c01c34ccc8bd5 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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.pineconevectordb.fluent.OperationsClient; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OperationInner; +import com.azure.resourcemanager.pineconevectordb.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 PineconeVectorDbMgmtClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(PineconeVectorDbMgmtClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PineconeVectorDbMgmtClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PineconeVectorDbMgmt") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Pinecone.VectorDb/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("{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); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationsImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..b8c56b7b73b49 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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.pineconevectordb.fluent.OperationsClient; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OperationInner; +import com.azure.resourcemanager.pineconevectordb.models.Operation; +import com.azure.resourcemanager.pineconevectordb.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.pineconevectordb.PineconeVectorDbManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager 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.pineconevectordb.PineconeVectorDbManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationResourceImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationResourceImpl.java new file mode 100644 index 0000000000000..cdf1cadc18320 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationResourceImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResourceUpdate; +import java.util.Collections; +import java.util.Map; + +public final class OrganizationResourceImpl + implements OrganizationResource, OrganizationResource.Definition, OrganizationResource.Update { + private OrganizationResourceInner innerObject; + + private final com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public OrganizationProperties properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public OrganizationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String organizationname; + + private OrganizationResourceUpdate updateProperties; + + public OrganizationResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public OrganizationResource create() { + this.innerObject = serviceManager.serviceClient() + .getOrganizations() + .createOrUpdate(resourceGroupName, organizationname, this.innerModel(), Context.NONE); + return this; + } + + public OrganizationResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getOrganizations() + .createOrUpdate(resourceGroupName, organizationname, this.innerModel(), context); + return this; + } + + OrganizationResourceImpl(String name, + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager serviceManager) { + this.innerObject = new OrganizationResourceInner(); + this.serviceManager = serviceManager; + this.organizationname = name; + } + + public OrganizationResourceImpl update() { + this.updateProperties = new OrganizationResourceUpdate(); + return this; + } + + public OrganizationResource apply() { + this.innerObject = serviceManager.serviceClient() + .getOrganizations() + .updateWithResponse(resourceGroupName, organizationname, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public OrganizationResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getOrganizations() + .updateWithResponse(resourceGroupName, organizationname, updateProperties, context) + .getValue(); + return this; + } + + OrganizationResourceImpl(OrganizationResourceInner innerObject, + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.organizationname = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "organizations"); + } + + public OrganizationResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getOrganizations() + .getByResourceGroupWithResponse(resourceGroupName, organizationname, Context.NONE) + .getValue(); + return this; + } + + public OrganizationResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getOrganizations() + .getByResourceGroupWithResponse(resourceGroupName, organizationname, context) + .getValue(); + return this; + } + + public OrganizationResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public OrganizationResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public OrganizationResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public OrganizationResourceImpl withProperties(OrganizationProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public OrganizationResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationsClientImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationsClientImpl.java new file mode 100644 index 0000000000000..ee901eb88c6a8 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationsClientImpl.java @@ -0,0 +1,1212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.pineconevectordb.fluent.OrganizationsClient; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.pineconevectordb.implementation.models.OrganizationResourceListResult; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResourceUpdate; +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 OrganizationsClient. + */ +public final class OrganizationsClientImpl implements OrganizationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OrganizationsService service; + + /** + * The service client containing this operation class. + */ + private final PineconeVectorDbMgmtClientImpl client; + + /** + * Initializes an instance of OrganizationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OrganizationsClientImpl(PineconeVectorDbMgmtClientImpl client) { + this.service + = RestProxy.create(OrganizationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PineconeVectorDbMgmtClientOrganizations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "PineconeVectorDbMgmt") + public interface OrganizationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Pinecone.VectorDb/organizations/{organizationname}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationname") String organizationname, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Pinecone.VectorDb/organizations/{organizationname}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationname") String organizationname, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") OrganizationResourceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Pinecone.VectorDb/organizations/{organizationname}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationname") String organizationname, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") OrganizationResourceUpdate properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Pinecone.VectorDb/organizations/{organizationname}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("organizationname") String organizationname, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Pinecone.VectorDb/organizations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Pinecone.VectorDb/organizations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@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> listByResourceGroupNext( + @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); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 a OrganizationResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String organizationname) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationname, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String organizationname, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationname, accept, context); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 a OrganizationResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String organizationname) { + return getByResourceGroupWithResponseAsync(resourceGroupName, organizationname) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String organizationname, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, organizationname, context).block(); + } + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 a OrganizationResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner getByResourceGroup(String resourceGroupName, String organizationname) { + return getByResourceGroupWithResponse(resourceGroupName, organizationname, Context.NONE).getValue(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String organizationname, OrganizationResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationname, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String organizationname, OrganizationResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationname, contentType, accept, resource, + context); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrganizationResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String organizationname, OrganizationResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, organizationname, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OrganizationResourceInner.class, OrganizationResourceInner.class, + this.client.getContext()); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, OrganizationResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String organizationname, OrganizationResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, organizationname, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), OrganizationResourceInner.class, OrganizationResourceInner.class, context); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrganizationResourceInner> + beginCreateOrUpdate(String resourceGroupName, String organizationname, OrganizationResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, organizationname, resource).getSyncPoller(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @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 concrete tracked resource types can be created by aliasing this + * type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, OrganizationResourceInner> beginCreateOrUpdate( + String resourceGroupName, String organizationname, OrganizationResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, organizationname, resource, context).getSyncPoller(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String organizationname, + OrganizationResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, organizationname, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String organizationname, + OrganizationResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, organizationname, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationname, + OrganizationResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, organizationname, resource).block(); + } + + /** + * Create a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param resource Resource create parameters. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner createOrUpdate(String resourceGroupName, String organizationname, + OrganizationResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, organizationname, resource, context).block(); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String organizationname, OrganizationResourceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationname, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String organizationname, OrganizationResourceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, organizationname, contentType, accept, properties, context); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String organizationname, + OrganizationResourceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, organizationname, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @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 concrete tracked resource types can be created by aliasing this type using a specific property type along + * with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String organizationname, + OrganizationResourceUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, organizationname, properties, context).block(); + } + + /** + * Update a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return concrete tracked resource types can be created by aliasing this type using a specific property type. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OrganizationResourceInner update(String resourceGroupName, String organizationname, + OrganizationResourceUpdate properties) { + return updateWithResponse(resourceGroupName, organizationname, properties, Context.NONE).getValue(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String organizationname) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, organizationname, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String organizationname, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (organizationname == null) { + return Mono + .error(new IllegalArgumentException("Parameter organizationname is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, organizationname, accept, context); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String organizationname) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, organizationname); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String organizationname, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, organizationname, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String organizationname) { + return this.beginDeleteAsync(resourceGroupName, organizationname).getSyncPoller(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String organizationname, + Context context) { + return this.beginDeleteAsync(resourceGroupName, organizationname, context).getSyncPoller(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String organizationname) { + return beginDeleteAsync(resourceGroupName, organizationname).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String organizationname, Context context) { + return beginDeleteAsync(resourceGroupName, organizationname, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String organizationname) { + deleteAsync(resourceGroupName, organizationname).block(); + } + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String organizationname, Context context) { + deleteAsync(resourceGroupName, organizationname, context).block(); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, 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 OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List OrganizationResource 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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.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 OrganizationResource 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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The 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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @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 OrganizationResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationsImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationsImpl.java new file mode 100644 index 0000000000000..2901e156e5256 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/OrganizationsImpl.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.pineconevectordb.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.pineconevectordb.fluent.OrganizationsClient; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.Organizations; + +public final class OrganizationsImpl implements Organizations { + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsImpl.class); + + private final OrganizationsClient innerClient; + + private final com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager serviceManager; + + public OrganizationsImpl(OrganizationsClient innerClient, + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String organizationname, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, organizationname, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OrganizationResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OrganizationResource getByResourceGroup(String resourceGroupName, String organizationname) { + OrganizationResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, organizationname); + if (inner != null) { + return new OrganizationResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String organizationname) { + this.serviceClient().delete(resourceGroupName, organizationname); + } + + public void delete(String resourceGroupName, String organizationname, Context context) { + this.serviceClient().delete(resourceGroupName, organizationname, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public OrganizationResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationname = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationname == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, organizationname, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationname = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationname == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, organizationname, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationname = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationname == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + this.delete(resourceGroupName, organizationname, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String organizationname = ResourceManagerUtils.getValueFromIdByName(id, "organizations"); + if (organizationname == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'organizations'.", id))); + } + this.delete(resourceGroupName, organizationname, context); + } + + private OrganizationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager() { + return this.serviceManager; + } + + public OrganizationResourceImpl define(String name) { + return new OrganizationResourceImpl(name, this.manager()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/PineconeVectorDbMgmtClientBuilder.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/PineconeVectorDbMgmtClientBuilder.java new file mode 100644 index 0000000000000..3a1e2fb3fb716 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/PineconeVectorDbMgmtClientBuilder.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.pineconevectordb.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 PineconeVectorDbMgmtClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { PineconeVectorDbMgmtClientImpl.class }) +public final class PineconeVectorDbMgmtClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the PineconeVectorDbMgmtClientBuilder. + */ + public PineconeVectorDbMgmtClientBuilder 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 PineconeVectorDbMgmtClientBuilder. + */ + public PineconeVectorDbMgmtClientBuilder 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 PineconeVectorDbMgmtClientBuilder. + */ + public PineconeVectorDbMgmtClientBuilder 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 PineconeVectorDbMgmtClientBuilder. + */ + public PineconeVectorDbMgmtClientBuilder 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 PineconeVectorDbMgmtClientBuilder. + */ + public PineconeVectorDbMgmtClientBuilder 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 PineconeVectorDbMgmtClientBuilder. + */ + public PineconeVectorDbMgmtClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PineconeVectorDbMgmtClientImpl with the provided parameters. + * + * @return an instance of PineconeVectorDbMgmtClientImpl. + */ + public PineconeVectorDbMgmtClientImpl 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(); + PineconeVectorDbMgmtClientImpl client = new PineconeVectorDbMgmtClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/PineconeVectorDbMgmtClientImpl.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/PineconeVectorDbMgmtClientImpl.java new file mode 100644 index 0000000000000..2d95b1d806f28 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/PineconeVectorDbMgmtClientImpl.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.pineconevectordb.fluent.OperationsClient; +import com.azure.resourcemanager.pineconevectordb.fluent.OrganizationsClient; +import com.azure.resourcemanager.pineconevectordb.fluent.PineconeVectorDbMgmtClient; +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 PineconeVectorDbMgmtClientImpl type. + */ +@ServiceClient(builder = PineconeVectorDbMgmtClientBuilder.class) +public final class PineconeVectorDbMgmtClientImpl implements PineconeVectorDbMgmtClient { + /** + * 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 OrganizationsClient object to access its operations. + */ + private final OrganizationsClient organizations; + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + public OrganizationsClient getOrganizations() { + return this.organizations; + } + + /** + * Initializes an instance of PineconeVectorDbMgmtClient 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. + */ + PineconeVectorDbMgmtClientImpl(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 = "2024-10-22-preview"; + this.operations = new OperationsClientImpl(this); + this.organizations = new OrganizationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(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(PineconeVectorDbMgmtClientImpl.class); +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/ResourceManagerUtils.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/ResourceManagerUtils.java new file mode 100644 index 0000000000000..6ea513cfc54d4 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/models/OperationListResult.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/models/OperationListResult.java new file mode 100644 index 0000000000000..59cc51f6bea0b --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.pineconevectordb.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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/models/OrganizationResourceListResult.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/models/OrganizationResourceListResult.java new file mode 100644 index 0000000000000..bbed5bee5a1a0 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/models/OrganizationResourceListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a OrganizationResource list operation. + */ +@Immutable +public final class OrganizationResourceListResult implements JsonSerializable { + /* + * The OrganizationResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OrganizationResourceListResult class. + */ + private OrganizationResourceListResult() { + } + + /** + * Get the value property: The OrganizationResource 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model OrganizationResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OrganizationResourceListResult.class); + + /** + * {@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 OrganizationResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrganizationResourceListResult 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 OrganizationResourceListResult. + */ + public static OrganizationResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OrganizationResourceListResult deserializedOrganizationResourceListResult + = new OrganizationResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> OrganizationResourceInner.fromJson(reader1)); + deserializedOrganizationResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOrganizationResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOrganizationResourceListResult; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/package-info.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/package-info.java new file mode 100644 index 0000000000000..96b80f0657a9c --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/implementation/package-info.java @@ -0,0 +1,8 @@ +// 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 PineconeVectorDb. + */ +package com.azure.resourcemanager.pineconevectordb.implementation; diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ActionType.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ActionType.java new file mode 100644 index 0000000000000..2abf5e848f109 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ManagedServiceIdentity.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..6974e414ccc11 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ManagedServiceIdentity.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity 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 ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ManagedServiceIdentityType.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..f8d3169ab0153 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/MarketplaceDetails.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/MarketplaceDetails.java new file mode 100644 index 0000000000000..ac286465bfb61 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/MarketplaceDetails.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Marketplace details for an organization. + */ +@Fluent +public final class MarketplaceDetails implements JsonSerializable { + /* + * Azure subscription id for the the marketplace offer is purchased from + */ + private String subscriptionId; + + /* + * Marketplace subscription status + */ + private MarketplaceSubscriptionStatus subscriptionStatus; + + /* + * Offer details for the marketplace that is selected by the user + */ + private OfferDetails offerDetails; + + /** + * Creates an instance of MarketplaceDetails class. + */ + public MarketplaceDetails() { + } + + /** + * Get the subscriptionId property: Azure subscription id for the the marketplace offer is purchased from. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Azure subscription id for the the marketplace offer is purchased from. + * + * @param subscriptionId the subscriptionId value to set. + * @return the MarketplaceDetails object itself. + */ + public MarketplaceDetails withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the subscriptionStatus property: Marketplace subscription status. + * + * @return the subscriptionStatus value. + */ + public MarketplaceSubscriptionStatus subscriptionStatus() { + return this.subscriptionStatus; + } + + /** + * Get the offerDetails property: Offer details for the marketplace that is selected by the user. + * + * @return the offerDetails value. + */ + public OfferDetails offerDetails() { + return this.offerDetails; + } + + /** + * Set the offerDetails property: Offer details for the marketplace that is selected by the user. + * + * @param offerDetails the offerDetails value to set. + * @return the MarketplaceDetails object itself. + */ + public MarketplaceDetails withOfferDetails(OfferDetails offerDetails) { + this.offerDetails = offerDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (subscriptionId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property subscriptionId in model MarketplaceDetails")); + } + if (offerDetails() == null) { + throw LOGGER.atError() + .log( + new IllegalArgumentException("Missing required property offerDetails in model MarketplaceDetails")); + } else { + offerDetails().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MarketplaceDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeJsonField("offerDetails", this.offerDetails); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MarketplaceDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MarketplaceDetails 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 MarketplaceDetails. + */ + public static MarketplaceDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MarketplaceDetails deserializedMarketplaceDetails = new MarketplaceDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedMarketplaceDetails.subscriptionId = reader.getString(); + } else if ("offerDetails".equals(fieldName)) { + deserializedMarketplaceDetails.offerDetails = OfferDetails.fromJson(reader); + } else if ("subscriptionStatus".equals(fieldName)) { + deserializedMarketplaceDetails.subscriptionStatus + = MarketplaceSubscriptionStatus.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMarketplaceDetails; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/MarketplaceSubscriptionStatus.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 0000000000000..47315186a7ff1 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Marketplace subscription status of a resource. + */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** + * Purchased but not yet activated. + */ + public static final MarketplaceSubscriptionStatus PENDING_FULFILLMENT_START = fromString("PendingFulfillmentStart"); + + /** + * Marketplace subscription is activated. + */ + public static final MarketplaceSubscriptionStatus SUBSCRIBED = fromString("Subscribed"); + + /** + * This state indicates that a customer's payment for the Marketplace service was not received. + */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Customer has cancelled the subscription. + */ + public static final MarketplaceSubscriptionStatus UNSUBSCRIBED = fromString("Unsubscribed"); + + /** + * Creates a new instance of MarketplaceSubscriptionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MarketplaceSubscriptionStatus() { + } + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** + * Gets known MarketplaceSubscriptionStatus values. + * + * @return known MarketplaceSubscriptionStatus values. + */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OfferDetails.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OfferDetails.java new file mode 100644 index 0000000000000..50fe0382605fa --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OfferDetails.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.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Offer details for the marketplace that is selected by the user. + */ +@Fluent +public final class OfferDetails implements JsonSerializable { + /* + * Publisher Id for the marketplace offer + */ + private String publisherId; + + /* + * Offer Id for the marketplace offer + */ + private String offerId; + + /* + * Plan Id for the marketplace offer + */ + private String planId; + + /* + * Plan Name for the marketplace offer + */ + private String planName; + + /* + * Plan Display Name for the marketplace offer + */ + private String termUnit; + + /* + * Plan Display Name for the marketplace offer + */ + private String termId; + + /** + * Creates an instance of OfferDetails class. + */ + public OfferDetails() { + } + + /** + * Get the publisherId property: Publisher Id for the marketplace offer. + * + * @return the publisherId value. + */ + public String publisherId() { + return this.publisherId; + } + + /** + * Set the publisherId property: Publisher Id for the marketplace offer. + * + * @param publisherId the publisherId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withPublisherId(String publisherId) { + this.publisherId = publisherId; + return this; + } + + /** + * Get the offerId property: Offer Id for the marketplace offer. + * + * @return the offerId value. + */ + public String offerId() { + return this.offerId; + } + + /** + * Set the offerId property: Offer Id for the marketplace offer. + * + * @param offerId the offerId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withOfferId(String offerId) { + this.offerId = offerId; + return this; + } + + /** + * Get the planId property: Plan Id for the marketplace offer. + * + * @return the planId value. + */ + public String planId() { + return this.planId; + } + + /** + * Set the planId property: Plan Id for the marketplace offer. + * + * @param planId the planId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withPlanId(String planId) { + this.planId = planId; + return this; + } + + /** + * Get the planName property: Plan Name for the marketplace offer. + * + * @return the planName value. + */ + public String planName() { + return this.planName; + } + + /** + * Set the planName property: Plan Name for the marketplace offer. + * + * @param planName the planName value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withPlanName(String planName) { + this.planName = planName; + return this; + } + + /** + * Get the termUnit property: Plan Display Name for the marketplace offer. + * + * @return the termUnit value. + */ + public String termUnit() { + return this.termUnit; + } + + /** + * Set the termUnit property: Plan Display Name for the marketplace offer. + * + * @param termUnit the termUnit value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withTermUnit(String termUnit) { + this.termUnit = termUnit; + return this; + } + + /** + * Get the termId property: Plan Display Name for the marketplace offer. + * + * @return the termId value. + */ + public String termId() { + return this.termId; + } + + /** + * Set the termId property: Plan Display Name for the marketplace offer. + * + * @param termId the termId value to set. + * @return the OfferDetails object itself. + */ + public OfferDetails withTermId(String termId) { + this.termId = termId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (publisherId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property publisherId in model OfferDetails")); + } + if (offerId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property offerId in model OfferDetails")); + } + if (planId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property planId in model OfferDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OfferDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publisherId", this.publisherId); + jsonWriter.writeStringField("offerId", this.offerId); + jsonWriter.writeStringField("planId", this.planId); + jsonWriter.writeStringField("planName", this.planName); + jsonWriter.writeStringField("termUnit", this.termUnit); + jsonWriter.writeStringField("termId", this.termId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OfferDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OfferDetails 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 OfferDetails. + */ + public static OfferDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OfferDetails deserializedOfferDetails = new OfferDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("publisherId".equals(fieldName)) { + deserializedOfferDetails.publisherId = reader.getString(); + } else if ("offerId".equals(fieldName)) { + deserializedOfferDetails.offerId = reader.getString(); + } else if ("planId".equals(fieldName)) { + deserializedOfferDetails.planId = reader.getString(); + } else if ("planName".equals(fieldName)) { + deserializedOfferDetails.planName = reader.getString(); + } else if ("termUnit".equals(fieldName)) { + deserializedOfferDetails.termUnit = reader.getString(); + } else if ("termId".equals(fieldName)) { + deserializedOfferDetails.termId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOfferDetails; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Operation.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Operation.java new file mode 100644 index 0000000000000..7f2701fd77cd4 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.models; + +import com.azure.resourcemanager.pineconevectordb.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.pineconevectordb.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OperationDisplay.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OperationDisplay.java new file mode 100644 index 0000000000000..5bdc51eee46f5 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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 and 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Operations.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Operations.java new file mode 100644 index 0000000000000..0fa6604ced524 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationProperties.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationProperties.java new file mode 100644 index 0000000000000..c2de621e46670 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationProperties.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Properties specific to Organization. + */ +@Fluent +public final class OrganizationProperties implements JsonSerializable { + /* + * Marketplace details of the resource. + */ + private MarketplaceDetails marketplace; + + /* + * Details of the user. + */ + private UserDetails user; + + /* + * Provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /* + * partner properties + */ + private PartnerProperties partnerProperties; + + /* + * Single sign-on properties + */ + private SingleSignOnPropertiesV2 singleSignOnProperties; + + /** + * Creates an instance of OrganizationProperties class. + */ + public OrganizationProperties() { + } + + /** + * Get the marketplace property: Marketplace details of the resource. + * + * @return the marketplace value. + */ + public MarketplaceDetails marketplace() { + return this.marketplace; + } + + /** + * Set the marketplace property: Marketplace details of the resource. + * + * @param marketplace the marketplace value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withMarketplace(MarketplaceDetails marketplace) { + this.marketplace = marketplace; + return this; + } + + /** + * Get the user property: Details of the user. + * + * @return the user value. + */ + public UserDetails user() { + return this.user; + } + + /** + * Set the user property: Details of the user. + * + * @param user the user value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withUser(UserDetails user) { + this.user = user; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the partnerProperties property: partner properties. + * + * @return the partnerProperties value. + */ + public PartnerProperties partnerProperties() { + return this.partnerProperties; + } + + /** + * Set the partnerProperties property: partner properties. + * + * @param partnerProperties the partnerProperties value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withPartnerProperties(PartnerProperties partnerProperties) { + this.partnerProperties = partnerProperties; + return this; + } + + /** + * Get the singleSignOnProperties property: Single sign-on properties. + * + * @return the singleSignOnProperties value. + */ + public SingleSignOnPropertiesV2 singleSignOnProperties() { + return this.singleSignOnProperties; + } + + /** + * Set the singleSignOnProperties property: Single sign-on properties. + * + * @param singleSignOnProperties the singleSignOnProperties value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withSingleSignOnProperties(SingleSignOnPropertiesV2 singleSignOnProperties) { + this.singleSignOnProperties = singleSignOnProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (marketplace() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property marketplace in model OrganizationProperties")); + } else { + marketplace().validate(); + } + if (user() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property user in model OrganizationProperties")); + } else { + user().validate(); + } + if (partnerProperties() != null) { + partnerProperties().validate(); + } + if (singleSignOnProperties() != null) { + singleSignOnProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OrganizationProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("marketplace", this.marketplace); + jsonWriter.writeJsonField("user", this.user); + jsonWriter.writeJsonField("partnerProperties", this.partnerProperties); + jsonWriter.writeJsonField("singleSignOnProperties", this.singleSignOnProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OrganizationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrganizationProperties 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 OrganizationProperties. + */ + public static OrganizationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OrganizationProperties deserializedOrganizationProperties = new OrganizationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("marketplace".equals(fieldName)) { + deserializedOrganizationProperties.marketplace = MarketplaceDetails.fromJson(reader); + } else if ("user".equals(fieldName)) { + deserializedOrganizationProperties.user = UserDetails.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedOrganizationProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("partnerProperties".equals(fieldName)) { + deserializedOrganizationProperties.partnerProperties = PartnerProperties.fromJson(reader); + } else if ("singleSignOnProperties".equals(fieldName)) { + deserializedOrganizationProperties.singleSignOnProperties + = SingleSignOnPropertiesV2.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOrganizationProperties; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationResource.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationResource.java new file mode 100644 index 0000000000000..12f9fa361873d --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationResource.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of OrganizationResource. + */ +public interface OrganizationResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + OrganizationProperties properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner object. + * + * @return the inner object. + */ + OrganizationResourceInner innerModel(); + + /** + * The entirety of the OrganizationResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The OrganizationResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the OrganizationResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the OrganizationResource definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the OrganizationResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the OrganizationResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, DefinitionStages.WithProperties, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + OrganizationResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + OrganizationResource create(Context context); + } + + /** + * The stage of the OrganizationResource definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the OrganizationResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(OrganizationProperties properties); + } + + /** + * The stage of the OrganizationResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the OrganizationResource resource. + * + * @return the stage of resource update. + */ + OrganizationResource.Update update(); + + /** + * The template for OrganizationResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + OrganizationResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + OrganizationResource apply(Context context); + } + + /** + * The OrganizationResource update stages. + */ + interface UpdateStages { + /** + * The stage of the OrganizationResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the OrganizationResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + OrganizationResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + OrganizationResource refresh(Context context); +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationResourceUpdate.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationResourceUpdate.java new file mode 100644 index 0000000000000..ea88c696ff508 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/OrganizationResourceUpdate.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the Organization Resource. + */ +@Fluent +public final class OrganizationResourceUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /** + * Creates an instance of OrganizationResourceUpdate class. + */ + public OrganizationResourceUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the OrganizationResourceUpdate object itself. + */ + public OrganizationResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the OrganizationResourceUpdate object itself. + */ + public OrganizationResourceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OrganizationResourceUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OrganizationResourceUpdate 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 OrganizationResourceUpdate. + */ + public static OrganizationResourceUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OrganizationResourceUpdate deserializedOrganizationResourceUpdate = new OrganizationResourceUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedOrganizationResourceUpdate.tags = tags; + } else if ("identity".equals(fieldName)) { + deserializedOrganizationResourceUpdate.identity = ManagedServiceIdentity.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedOrganizationResourceUpdate; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Organizations.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Organizations.java new file mode 100644 index 0000000000000..0933a0bbea779 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Organizations.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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 Organizations. + */ +public interface Organizations { + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String organizationname, + Context context); + + /** + * Get a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization 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 a OrganizationResource. + */ + OrganizationResource getByResourceGroup(String resourceGroupName, String organizationname); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String organizationname); + + /** + * Delete a OrganizationResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param organizationname Name of the Organization resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String organizationname, Context context); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List OrganizationResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List OrganizationResource 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 OrganizationResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a OrganizationResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + OrganizationResource getById(String id); + + /** + * Get a OrganizationResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a OrganizationResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a OrganizationResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a OrganizationResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new OrganizationResource resource. + * + * @param name resource name. + * @return the first stage of the new OrganizationResource definition. + */ + OrganizationResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Origin.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/Origin.java new file mode 100644 index 0000000000000..51676cf402a93 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/PartnerProperties.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/PartnerProperties.java new file mode 100644 index 0000000000000..d51a78823a595 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/PartnerProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Partner's specific Properties. + */ +@Fluent +public final class PartnerProperties implements JsonSerializable { + /* + * Pinecone Organization Name + */ + private String displayName; + + /** + * Creates an instance of PartnerProperties class. + */ + public PartnerProperties() { + } + + /** + * Get the displayName property: Pinecone Organization Name. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: Pinecone Organization Name. + * + * @param displayName the displayName value to set. + * @return the PartnerProperties object itself. + */ + public PartnerProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (displayName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property displayName in model PartnerProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PartnerProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("displayName", this.displayName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PartnerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PartnerProperties 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 PartnerProperties. + */ + public static PartnerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PartnerProperties deserializedPartnerProperties = new PartnerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("displayName".equals(fieldName)) { + deserializedPartnerProperties.displayName = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPartnerProperties; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ResourceProvisioningState.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/ResourceProvisioningState.java new file mode 100644 index 0000000000000..986aedbcaed59 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnPropertiesV2.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnPropertiesV2.java new file mode 100644 index 0000000000000..7f158f7cf7993 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnPropertiesV2.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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; + +/** + * Properties specific to Single Sign On Resource. + */ +@Fluent +public final class SingleSignOnPropertiesV2 implements JsonSerializable { + /* + * Type of Single Sign-On mechanism being used + */ + private SingleSignOnType type; + + /* + * State of the Single Sign On for the resource + */ + private SingleSignOnStates state; + + /* + * AAD enterprise application Id used to setup SSO + */ + private String enterpriseAppId; + + /* + * URL for SSO to be used by the partner to redirect the user to their system + */ + private String url; + + /* + * List of AAD domains fetched from Microsoft Graph for user. + */ + private List aadDomains; + + /** + * Creates an instance of SingleSignOnPropertiesV2 class. + */ + public SingleSignOnPropertiesV2() { + } + + /** + * Get the type property: Type of Single Sign-On mechanism being used. + * + * @return the type value. + */ + public SingleSignOnType type() { + return this.type; + } + + /** + * Set the type property: Type of Single Sign-On mechanism being used. + * + * @param type the type value to set. + * @return the SingleSignOnPropertiesV2 object itself. + */ + public SingleSignOnPropertiesV2 withType(SingleSignOnType type) { + this.type = type; + return this; + } + + /** + * Get the state property: State of the Single Sign On for the resource. + * + * @return the state value. + */ + public SingleSignOnStates state() { + return this.state; + } + + /** + * Set the state property: State of the Single Sign On for the resource. + * + * @param state the state value to set. + * @return the SingleSignOnPropertiesV2 object itself. + */ + public SingleSignOnPropertiesV2 withState(SingleSignOnStates state) { + this.state = state; + return this; + } + + /** + * Get the enterpriseAppId property: AAD enterprise application Id used to setup SSO. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: AAD enterprise application Id used to setup SSO. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the SingleSignOnPropertiesV2 object itself. + */ + public SingleSignOnPropertiesV2 withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Get the url property: URL for SSO to be used by the partner to redirect the user to their system. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: URL for SSO to be used by the partner to redirect the user to their system. + * + * @param url the url value to set. + * @return the SingleSignOnPropertiesV2 object itself. + */ + public SingleSignOnPropertiesV2 withUrl(String url) { + this.url = url; + return this; + } + + /** + * Get the aadDomains property: List of AAD domains fetched from Microsoft Graph for user. + * + * @return the aadDomains value. + */ + public List aadDomains() { + return this.aadDomains; + } + + /** + * Set the aadDomains property: List of AAD domains fetched from Microsoft Graph for user. + * + * @param aadDomains the aadDomains value to set. + * @return the SingleSignOnPropertiesV2 object itself. + */ + public SingleSignOnPropertiesV2 withAadDomains(List aadDomains) { + this.aadDomains = aadDomains; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model SingleSignOnPropertiesV2")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SingleSignOnPropertiesV2.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeStringField("enterpriseAppId", this.enterpriseAppId); + jsonWriter.writeStringField("url", this.url); + jsonWriter.writeArrayField("aadDomains", this.aadDomains, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SingleSignOnPropertiesV2 from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SingleSignOnPropertiesV2 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 SingleSignOnPropertiesV2. + */ + public static SingleSignOnPropertiesV2 fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SingleSignOnPropertiesV2 deserializedSingleSignOnPropertiesV2 = new SingleSignOnPropertiesV2(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedSingleSignOnPropertiesV2.type = SingleSignOnType.fromString(reader.getString()); + } else if ("state".equals(fieldName)) { + deserializedSingleSignOnPropertiesV2.state = SingleSignOnStates.fromString(reader.getString()); + } else if ("enterpriseAppId".equals(fieldName)) { + deserializedSingleSignOnPropertiesV2.enterpriseAppId = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedSingleSignOnPropertiesV2.url = reader.getString(); + } else if ("aadDomains".equals(fieldName)) { + List aadDomains = reader.readArray(reader1 -> reader1.getString()); + deserializedSingleSignOnPropertiesV2.aadDomains = aadDomains; + } else { + reader.skipChildren(); + } + } + + return deserializedSingleSignOnPropertiesV2; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnStates.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnStates.java new file mode 100644 index 0000000000000..5ed28b5fa1f4a --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnStates.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.pineconevectordb.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Various states of the SSO resource. + */ +public final class SingleSignOnStates extends ExpandableStringEnum { + /** + * Initial state of the SSO resource. + */ + public static final SingleSignOnStates INITIAL = fromString("Initial"); + + /** + * State of the SSO resource when it is enabled. + */ + public static final SingleSignOnStates ENABLE = fromString("Enable"); + + /** + * State of the SSO resource when it is disabled. + */ + public static final SingleSignOnStates DISABLE = fromString("Disable"); + + /** + * Creates a new instance of SingleSignOnStates value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SingleSignOnStates() { + } + + /** + * Creates or finds a SingleSignOnStates from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnStates. + */ + public static SingleSignOnStates fromString(String name) { + return fromString(name, SingleSignOnStates.class); + } + + /** + * Gets known SingleSignOnStates values. + * + * @return known SingleSignOnStates values. + */ + public static Collection values() { + return values(SingleSignOnStates.class); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnType.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnType.java new file mode 100644 index 0000000000000..b5dac4c4ed1b8 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/SingleSignOnType.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.pineconevectordb.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Defines the type of Single Sign-On (SSO) mechanism being used. + */ +public final class SingleSignOnType extends ExpandableStringEnum { + /** + * Security Assertion Markup Language (SAML) based Single Sign-On. + */ + public static final SingleSignOnType SAML = fromString("Saml"); + + /** + * OpenID Connect based Single Sign-On. + */ + public static final SingleSignOnType OPEN_ID = fromString("OpenId"); + + /** + * Creates a new instance of SingleSignOnType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SingleSignOnType() { + } + + /** + * Creates or finds a SingleSignOnType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnType. + */ + public static SingleSignOnType fromString(String name) { + return fromString(name, SingleSignOnType.class); + } + + /** + * Gets known SingleSignOnType values. + * + * @return known SingleSignOnType values. + */ + public static Collection values() { + return values(SingleSignOnType.class); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/UserAssignedIdentity.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..f2984e8c21891 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/UserAssignedIdentity.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.pineconevectordb.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; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity 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 UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/UserDetails.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/UserDetails.java new file mode 100644 index 0000000000000..9e9771f0490c2 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/UserDetails.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User details for an organization. + */ +@Fluent +public final class UserDetails implements JsonSerializable { + /* + * First name of the user + */ + private String firstName; + + /* + * Last name of the user + */ + private String lastName; + + /* + * Email address of the user + */ + private String emailAddress; + + /* + * User's principal name + */ + private String upn; + + /* + * User's phone number + */ + private String phoneNumber; + + /** + * Creates an instance of UserDetails class. + */ + public UserDetails() { + } + + /** + * Get the firstName property: First name of the user. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name of the user. + * + * @param firstName the firstName value to set. + * @return the UserDetails object itself. + */ + public UserDetails withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name of the user. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name of the user. + * + * @param lastName the lastName value to set. + * @return the UserDetails object itself. + */ + public UserDetails withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: Email address of the user. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: Email address of the user. + * + * @param emailAddress the emailAddress value to set. + * @return the UserDetails object itself. + */ + public UserDetails withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the upn property: User's principal name. + * + * @return the upn value. + */ + public String upn() { + return this.upn; + } + + /** + * Set the upn property: User's principal name. + * + * @param upn the upn value to set. + * @return the UserDetails object itself. + */ + public UserDetails withUpn(String upn) { + this.upn = upn; + return this; + } + + /** + * Get the phoneNumber property: User's phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: User's phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the UserDetails object itself. + */ + public UserDetails withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (firstName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property firstName in model UserDetails")); + } + if (lastName() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property lastName in model UserDetails")); + } + if (emailAddress() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property emailAddress in model UserDetails")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(UserDetails.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("firstName", this.firstName); + jsonWriter.writeStringField("lastName", this.lastName); + jsonWriter.writeStringField("emailAddress", this.emailAddress); + jsonWriter.writeStringField("upn", this.upn); + jsonWriter.writeStringField("phoneNumber", this.phoneNumber); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserDetails 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 UserDetails. + */ + public static UserDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserDetails deserializedUserDetails = new UserDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("firstName".equals(fieldName)) { + deserializedUserDetails.firstName = reader.getString(); + } else if ("lastName".equals(fieldName)) { + deserializedUserDetails.lastName = reader.getString(); + } else if ("emailAddress".equals(fieldName)) { + deserializedUserDetails.emailAddress = reader.getString(); + } else if ("upn".equals(fieldName)) { + deserializedUserDetails.upn = reader.getString(); + } else if ("phoneNumber".equals(fieldName)) { + deserializedUserDetails.phoneNumber = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserDetails; + }); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/package-info.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/package-info.java new file mode 100644 index 0000000000000..f64872aa31209 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/models/package-info.java @@ -0,0 +1,8 @@ +// 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 PineconeVectorDb. + */ +package com.azure.resourcemanager.pineconevectordb.models; diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/package-info.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/package-info.java new file mode 100644 index 0000000000000..d5eebf706e750 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/com/azure/resourcemanager/pineconevectordb/package-info.java @@ -0,0 +1,8 @@ +// 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 PineconeVectorDb. + */ +package com.azure.resourcemanager.pineconevectordb; diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/module-info.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/java/module-info.java new file mode 100644 index 0000000000000..e435a0c620826 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/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.pineconevectordb { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.pineconevectordb; + exports com.azure.resourcemanager.pineconevectordb.fluent; + exports com.azure.resourcemanager.pineconevectordb.fluent.models; + exports com.azure.resourcemanager.pineconevectordb.models; + + opens com.azure.resourcemanager.pineconevectordb.fluent.models to com.azure.core; + opens com.azure.resourcemanager.pineconevectordb.models to com.azure.core; + opens com.azure.resourcemanager.pineconevectordb.implementation.models to com.azure.core; +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-pineconevectordb/proxy-config.json b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-pineconevectordb/proxy-config.json new file mode 100644 index 0000000000000..447510e74b1a5 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-pineconevectordb/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.pineconevectordb.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.pineconevectordb.implementation.OrganizationsClientImpl$OrganizationsService"]] \ No newline at end of file diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-pineconevectordb/reflect-config.json b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-pineconevectordb/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-pineconevectordb/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OperationsListSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..a08028aac478b --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OperationsListSamples.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.pineconevectordb.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + operationsListMinimumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2024-10-22-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + operationsListMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsCreateOrUpdateSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..88b33f4166149 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsCreateOrUpdateSamples.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.generated; + +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.MarketplaceDetails; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import com.azure.resourcemanager.pineconevectordb.models.PartnerProperties; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnPropertiesV2; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import com.azure.resourcemanager.pineconevectordb.models.UserDetails; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations CreateOrUpdate. + */ +public final class OrganizationsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void organizationsCreateOrUpdateMaximumSet( + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations() + .define("example-organization-name") + .withRegion("us-east") + .withExistingResourceGroup("rgopenapi") + .withTags(mapOf("my-tag", "tag.value")) + .withProperties(new OrganizationProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("76a38ef6-c8c1-4f0d-bfe0-00ec782c8077") + .withOfferDetails(new OfferDetails().withPublisherId("4d194daf-fa20-46a8-bfb4-5b7d96cae009") + .withOfferId("013124d0-bf05-4eab-a6bb-01fa83870642") + .withPlanId("62dda065-5acd-4ac5-b418-8610beed92a2") + .withPlanName("Freemium") + .withTermUnit("der") + .withTermId("a2b7ce01-f06d-4874-9f77-6ea4a4875c16"))) + .withUser(new UserDetails().withFirstName("Jimmy") + .withLastName("McExample") + .withEmailAddress("example.user@example.com") + .withUpn("example.user@example.com") + .withPhoneNumber("555-555-5555")) + .withPartnerProperties(new PartnerProperties().withDisplayName("My Example Organization")) + .withSingleSignOnProperties(new SingleSignOnPropertiesV2().withType(SingleSignOnType.SAML) + .withState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("44d3fb26-d8d5-41ff-9b9a-769737f22f13") + .withUrl("https://login.pinecone.io/?sso=true&connection=dfwgsqzkbrjqrglcsa") + .withAadDomains(Arrays.asList("exampledomain")))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("ident904655400", new UserAssignedIdentity()))) + .create(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsDeleteSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsDeleteSamples.java new file mode 100644 index 0000000000000..589fdd2d76443 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsDeleteSamples.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.pineconevectordb.generated; + +/** + * Samples for Organizations Delete. + */ +public final class OrganizationsDeleteSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Delete_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + organizationsDeleteMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations().delete("rgopenapi", "example-organization-name", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsGetByResourceGroupSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0f133dc0b310d --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsGetByResourceGroupSamples.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.pineconevectordb.generated; + +/** + * Samples for Organizations GetByResourceGroup. + */ +public final class OrganizationsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Get_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + organizationsGetMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations() + .getByResourceGroupWithResponse("rgopenapi", "example-organization-name", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListByResourceGroupSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..8cfacbf01c56a --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListByResourceGroupSamples.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.pineconevectordb.generated; + +/** + * Samples for Organizations ListByResourceGroup. + */ +public final class OrganizationsListByResourceGroupSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void organizationsListByResourceGroupMaximumSet( + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations().listByResourceGroup("rgopenapi", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListSamples.java new file mode 100644 index 0000000000000..4fd9247eed4b7 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListSamples.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.pineconevectordb.generated; + +/** + * Samples for Organizations List. + */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_ListBySubscription_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void organizationsListBySubscriptionMaximumSet( + com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + manager.organizations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsUpdateSamples.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsUpdateSamples.java new file mode 100644 index 0000000000000..e94463650c52d --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/samples/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsUpdateSamples.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.pineconevectordb.generated; + +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Organizations Update. + */ +public final class OrganizationsUpdateSamples { + /* + * x-ms-original-file: 2024-10-22-preview/Organizations_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_Update_MaximumSet. + * + * @param manager Entry point to PineconeVectorDbManager. + */ + public static void + organizationsUpdateMaximumSet(com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager manager) { + OrganizationResource resource = manager.organizations() + .getByResourceGroupWithResponse("rgopenapi", "example-organization-name", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("new-tag", "new.tag.value")) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("ident573739201", new UserAssignedIdentity()))) + .apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/ManagedServiceIdentityTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/ManagedServiceIdentityTests.java new file mode 100644 index 0000000000000..c605b9571df6a --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"ol\",\"tenantId\":\"fpsalgbqu\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"rkujy\":{\"principalId\":\"jgzjaoyfhrtx\",\"clientId\":\"n\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("rkujy", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/MarketplaceDetailsTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/MarketplaceDetailsTests.java new file mode 100644 index 0000000000000..f5a67a7b32550 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/MarketplaceDetailsTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.MarketplaceDetails; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import org.junit.jupiter.api.Assertions; + +public final class MarketplaceDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MarketplaceDetails model = BinaryData.fromString( + "{\"subscriptionId\":\"bdkvwrwjf\",\"subscriptionStatus\":\"PendingFulfillmentStart\",\"offerDetails\":{\"publisherId\":\"nhutjeltmrldhugj\",\"offerId\":\"zdatqxhocdg\",\"planId\":\"ablgphuticndvk\",\"planName\":\"zwyiftyhxhur\",\"termUnit\":\"ftyxolniw\",\"termId\":\"cukjf\"}}") + .toObject(MarketplaceDetails.class); + Assertions.assertEquals("bdkvwrwjf", model.subscriptionId()); + Assertions.assertEquals("nhutjeltmrldhugj", model.offerDetails().publisherId()); + Assertions.assertEquals("zdatqxhocdg", model.offerDetails().offerId()); + Assertions.assertEquals("ablgphuticndvk", model.offerDetails().planId()); + Assertions.assertEquals("zwyiftyhxhur", model.offerDetails().planName()); + Assertions.assertEquals("ftyxolniw", model.offerDetails().termUnit()); + Assertions.assertEquals("cukjf", model.offerDetails().termId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MarketplaceDetails model = new MarketplaceDetails().withSubscriptionId("bdkvwrwjf") + .withOfferDetails(new OfferDetails().withPublisherId("nhutjeltmrldhugj") + .withOfferId("zdatqxhocdg") + .withPlanId("ablgphuticndvk") + .withPlanName("zwyiftyhxhur") + .withTermUnit("ftyxolniw") + .withTermId("cukjf")); + model = BinaryData.fromObject(model).toObject(MarketplaceDetails.class); + Assertions.assertEquals("bdkvwrwjf", model.subscriptionId()); + Assertions.assertEquals("nhutjeltmrldhugj", model.offerDetails().publisherId()); + Assertions.assertEquals("zdatqxhocdg", model.offerDetails().offerId()); + Assertions.assertEquals("ablgphuticndvk", model.offerDetails().planId()); + Assertions.assertEquals("zwyiftyhxhur", model.offerDetails().planName()); + Assertions.assertEquals("ftyxolniw", model.offerDetails().termUnit()); + Assertions.assertEquals("cukjf", model.offerDetails().termId()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OfferDetailsTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OfferDetailsTests.java new file mode 100644 index 0000000000000..90e39a5bbcc15 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OfferDetailsTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import org.junit.jupiter.api.Assertions; + +public final class OfferDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OfferDetails model = BinaryData.fromString( + "{\"publisherId\":\"giawx\",\"offerId\":\"lryplwckbasyy\",\"planId\":\"nddhsgcbacph\",\"planName\":\"koty\",\"termUnit\":\"gou\",\"termId\":\"ndlik\"}") + .toObject(OfferDetails.class); + Assertions.assertEquals("giawx", model.publisherId()); + Assertions.assertEquals("lryplwckbasyy", model.offerId()); + Assertions.assertEquals("nddhsgcbacph", model.planId()); + Assertions.assertEquals("koty", model.planName()); + Assertions.assertEquals("gou", model.termUnit()); + Assertions.assertEquals("ndlik", model.termId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OfferDetails model = new OfferDetails().withPublisherId("giawx") + .withOfferId("lryplwckbasyy") + .withPlanId("nddhsgcbacph") + .withPlanName("koty") + .withTermUnit("gou") + .withTermId("ndlik"); + model = BinaryData.fromObject(model).toObject(OfferDetails.class); + Assertions.assertEquals("giawx", model.publisherId()); + Assertions.assertEquals("lryplwckbasyy", model.offerId()); + Assertions.assertEquals("nddhsgcbacph", model.planId()); + Assertions.assertEquals("koty", model.planName()); + Assertions.assertEquals("gou", model.termUnit()); + Assertions.assertEquals("ndlik", model.termId()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationDisplayTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..abb0752a4eb83 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationInnerTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationInnerTests.java new file mode 100644 index 0000000000000..7b4cdb25ea476 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationListResultTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationListResultTests.java new file mode 100644 index 0000000000000..2c2e7fbb941be --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.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/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationsListMockTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OperationsListMockTests.java new file mode 100644 index 0000000000000..ae6d8ba4082ea --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/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.pineconevectordb.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.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager; +import com.azure.resourcemanager.pineconevectordb.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\":\"a\",\"isDataAction\":true,\"display\":{\"provider\":\"z\",\"resource\":\"vvtpgvdfgio\",\"operation\":\"ftutqxlngxlefgu\",\"description\":\"xkrxdqmi\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PineconeVectorDbManager manager = PineconeVectorDbManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationPropertiesTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationPropertiesTests.java new file mode 100644 index 0000000000000..f7a3295e15a17 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationPropertiesTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.MarketplaceDetails; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import com.azure.resourcemanager.pineconevectordb.models.PartnerProperties; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnPropertiesV2; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import com.azure.resourcemanager.pineconevectordb.models.UserDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationProperties model = BinaryData.fromString( + "{\"marketplace\":{\"subscriptionId\":\"zrnf\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"gispemvtzfkufubl\",\"offerId\":\"ofx\",\"planId\":\"eofjaeqjh\",\"planName\":\"b\",\"termUnit\":\"v\",\"termId\":\"mjqulngsn\"}},\"user\":{\"firstName\":\"nbybkzgcwrwcl\",\"lastName\":\"xwrljdouskcqvkoc\",\"emailAddress\":\"cjdkwtnhxbnjbi\",\"upn\":\"qrglssainqpjwn\",\"phoneNumber\":\"ljfmppee\"},\"provisioningState\":\"Canceled\",\"partnerProperties\":{\"displayName\":\"xsabkyqdu\"},\"singleSignOnProperties\":{\"type\":\"Saml\",\"state\":\"Disable\",\"enterpriseAppId\":\"czdzev\",\"url\":\"hkr\",\"aadDomains\":[\"appd\"]}}") + .toObject(OrganizationProperties.class); + Assertions.assertEquals("zrnf", model.marketplace().subscriptionId()); + Assertions.assertEquals("gispemvtzfkufubl", model.marketplace().offerDetails().publisherId()); + Assertions.assertEquals("ofx", model.marketplace().offerDetails().offerId()); + Assertions.assertEquals("eofjaeqjh", model.marketplace().offerDetails().planId()); + Assertions.assertEquals("b", model.marketplace().offerDetails().planName()); + Assertions.assertEquals("v", model.marketplace().offerDetails().termUnit()); + Assertions.assertEquals("mjqulngsn", model.marketplace().offerDetails().termId()); + Assertions.assertEquals("nbybkzgcwrwcl", model.user().firstName()); + Assertions.assertEquals("xwrljdouskcqvkoc", model.user().lastName()); + Assertions.assertEquals("cjdkwtnhxbnjbi", model.user().emailAddress()); + Assertions.assertEquals("qrglssainqpjwn", model.user().upn()); + Assertions.assertEquals("ljfmppee", model.user().phoneNumber()); + Assertions.assertEquals("xsabkyqdu", model.partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.SAML, model.singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, model.singleSignOnProperties().state()); + Assertions.assertEquals("czdzev", model.singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("hkr", model.singleSignOnProperties().url()); + Assertions.assertEquals("appd", model.singleSignOnProperties().aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationProperties model = new OrganizationProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("zrnf") + .withOfferDetails(new OfferDetails().withPublisherId("gispemvtzfkufubl") + .withOfferId("ofx") + .withPlanId("eofjaeqjh") + .withPlanName("b") + .withTermUnit("v") + .withTermId("mjqulngsn"))) + .withUser(new UserDetails().withFirstName("nbybkzgcwrwcl") + .withLastName("xwrljdouskcqvkoc") + .withEmailAddress("cjdkwtnhxbnjbi") + .withUpn("qrglssainqpjwn") + .withPhoneNumber("ljfmppee")) + .withPartnerProperties(new PartnerProperties().withDisplayName("xsabkyqdu")) + .withSingleSignOnProperties(new SingleSignOnPropertiesV2().withType(SingleSignOnType.SAML) + .withState(SingleSignOnStates.DISABLE) + .withEnterpriseAppId("czdzev") + .withUrl("hkr") + .withAadDomains(Arrays.asList("appd"))); + model = BinaryData.fromObject(model).toObject(OrganizationProperties.class); + Assertions.assertEquals("zrnf", model.marketplace().subscriptionId()); + Assertions.assertEquals("gispemvtzfkufubl", model.marketplace().offerDetails().publisherId()); + Assertions.assertEquals("ofx", model.marketplace().offerDetails().offerId()); + Assertions.assertEquals("eofjaeqjh", model.marketplace().offerDetails().planId()); + Assertions.assertEquals("b", model.marketplace().offerDetails().planName()); + Assertions.assertEquals("v", model.marketplace().offerDetails().termUnit()); + Assertions.assertEquals("mjqulngsn", model.marketplace().offerDetails().termId()); + Assertions.assertEquals("nbybkzgcwrwcl", model.user().firstName()); + Assertions.assertEquals("xwrljdouskcqvkoc", model.user().lastName()); + Assertions.assertEquals("cjdkwtnhxbnjbi", model.user().emailAddress()); + Assertions.assertEquals("qrglssainqpjwn", model.user().upn()); + Assertions.assertEquals("ljfmppee", model.user().phoneNumber()); + Assertions.assertEquals("xsabkyqdu", model.partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.SAML, model.singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, model.singleSignOnProperties().state()); + Assertions.assertEquals("czdzev", model.singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("hkr", model.singleSignOnProperties().url()); + Assertions.assertEquals("appd", model.singleSignOnProperties().aadDomains().get(0)); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceInnerTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceInnerTests.java new file mode 100644 index 0000000000000..c412970361c2a --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceInnerTests.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.MarketplaceDetails; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import com.azure.resourcemanager.pineconevectordb.models.PartnerProperties; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnPropertiesV2; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import com.azure.resourcemanager.pineconevectordb.models.UserDetails; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceInner model = BinaryData.fromString( + "{\"properties\":{\"marketplace\":{\"subscriptionId\":\"ijbpzvgnwzsymgl\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"cyzkohdbihanuf\",\"offerId\":\"fcbjysagithxqha\",\"planId\":\"ifpikxwczby\",\"planName\":\"npqxuh\",\"termUnit\":\"y\",\"termId\":\"iwbybrkxvdumjg\"}},\"user\":{\"firstName\":\"tfwvukxgaudc\",\"lastName\":\"snhsjcnyejhkryh\",\"emailAddress\":\"napczwlokjy\",\"upn\":\"kkvnipjox\",\"phoneNumber\":\"nchgej\"},\"provisioningState\":\"Failed\",\"partnerProperties\":{\"displayName\":\"mailzydehojw\"},\"singleSignOnProperties\":{\"type\":\"OpenId\",\"state\":\"Initial\",\"enterpriseAppId\":\"npmqnjaqwixjspro\",\"url\":\"cputegjvwmfdats\",\"aadDomains\":[\"vpjhulsuuv\",\"kjozkrwfnd\",\"odjpslwejd\",\"vwryoqpso\"]}},\"identity\":{\"principalId\":\"tazak\",\"tenantId\":\"lahbcryff\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"hlxaolthqtr\":{\"principalId\":\"ygexpaojakhmsb\",\"clientId\":\"hcrzevd\"},\"tfell\":{\"principalId\":\"jbp\",\"clientId\":\"fsinzgvfcjrwzoxx\"}}},\"location\":\"fziton\",\"tags\":{\"vhpfxxypininmay\":\"fpjkjlxofp\",\"oginuvamiheognar\":\"uybbkpodep\"},\"id\":\"zxtheotusivyevcc\",\"name\":\"qi\",\"type\":\"nhungbw\"}") + .toObject(OrganizationResourceInner.class); + Assertions.assertEquals("fziton", model.location()); + Assertions.assertEquals("fpjkjlxofp", model.tags().get("vhpfxxypininmay")); + Assertions.assertEquals("ijbpzvgnwzsymgl", model.properties().marketplace().subscriptionId()); + Assertions.assertEquals("cyzkohdbihanuf", model.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("fcbjysagithxqha", model.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("ifpikxwczby", model.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("npqxuh", model.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("y", model.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("iwbybrkxvdumjg", model.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("tfwvukxgaudc", model.properties().user().firstName()); + Assertions.assertEquals("snhsjcnyejhkryh", model.properties().user().lastName()); + Assertions.assertEquals("napczwlokjy", model.properties().user().emailAddress()); + Assertions.assertEquals("kkvnipjox", model.properties().user().upn()); + Assertions.assertEquals("nchgej", model.properties().user().phoneNumber()); + Assertions.assertEquals("mailzydehojw", model.properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.OPEN_ID, model.properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, model.properties().singleSignOnProperties().state()); + Assertions.assertEquals("npmqnjaqwixjspro", model.properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("cputegjvwmfdats", model.properties().singleSignOnProperties().url()); + Assertions.assertEquals("vpjhulsuuv", model.properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceInner model = new OrganizationResourceInner().withLocation("fziton") + .withTags(mapOf("vhpfxxypininmay", "fpjkjlxofp", "oginuvamiheognar", "uybbkpodep")) + .withProperties(new OrganizationProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("ijbpzvgnwzsymgl") + .withOfferDetails(new OfferDetails().withPublisherId("cyzkohdbihanuf") + .withOfferId("fcbjysagithxqha") + .withPlanId("ifpikxwczby") + .withPlanName("npqxuh") + .withTermUnit("y") + .withTermId("iwbybrkxvdumjg"))) + .withUser(new UserDetails().withFirstName("tfwvukxgaudc") + .withLastName("snhsjcnyejhkryh") + .withEmailAddress("napczwlokjy") + .withUpn("kkvnipjox") + .withPhoneNumber("nchgej")) + .withPartnerProperties(new PartnerProperties().withDisplayName("mailzydehojw")) + .withSingleSignOnProperties(new SingleSignOnPropertiesV2().withType(SingleSignOnType.OPEN_ID) + .withState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("npmqnjaqwixjspro") + .withUrl("cputegjvwmfdats") + .withAadDomains(Arrays.asList("vpjhulsuuv", "kjozkrwfnd", "odjpslwejd", "vwryoqpso")))) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("hlxaolthqtr", new UserAssignedIdentity(), "tfell", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(OrganizationResourceInner.class); + Assertions.assertEquals("fziton", model.location()); + Assertions.assertEquals("fpjkjlxofp", model.tags().get("vhpfxxypininmay")); + Assertions.assertEquals("ijbpzvgnwzsymgl", model.properties().marketplace().subscriptionId()); + Assertions.assertEquals("cyzkohdbihanuf", model.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("fcbjysagithxqha", model.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("ifpikxwczby", model.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("npqxuh", model.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("y", model.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("iwbybrkxvdumjg", model.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("tfwvukxgaudc", model.properties().user().firstName()); + Assertions.assertEquals("snhsjcnyejhkryh", model.properties().user().lastName()); + Assertions.assertEquals("napczwlokjy", model.properties().user().emailAddress()); + Assertions.assertEquals("kkvnipjox", model.properties().user().upn()); + Assertions.assertEquals("nchgej", model.properties().user().phoneNumber()); + Assertions.assertEquals("mailzydehojw", model.properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.OPEN_ID, model.properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, model.properties().singleSignOnProperties().state()); + Assertions.assertEquals("npmqnjaqwixjspro", model.properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("cputegjvwmfdats", model.properties().singleSignOnProperties().url()); + Assertions.assertEquals("vpjhulsuuv", model.properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceListResultTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceListResultTests.java new file mode 100644 index 0000000000000..484ad07b09df8 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceListResultTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.implementation.models.OrganizationResourceListResult; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"marketplace\":{\"subscriptionId\":\"nb\",\"subscriptionStatus\":\"Subscribed\",\"offerDetails\":{\"publisherId\":\"abnmocpcyshu\",\"offerId\":\"zafb\",\"planId\":\"jjgpb\",\"planName\":\"qcjm\",\"termUnit\":\"javbqidtqajz\",\"termId\":\"l\"}},\"user\":{\"firstName\":\"kudjkrlkhb\",\"lastName\":\"hfepgzgqex\",\"emailAddress\":\"locx\",\"upn\":\"paierh\",\"phoneNumber\":\"csglum\"},\"provisioningState\":\"Canceled\",\"partnerProperties\":{\"displayName\":\"j\"},\"singleSignOnProperties\":{\"type\":\"Saml\",\"state\":\"Initial\",\"enterpriseAppId\":\"nbdxk\",\"url\":\"xo\",\"aadDomains\":[\"ionpimexg\",\"txgcpodgmaajr\",\"vdjwzrlovm\",\"lwhijcoejctbzaq\"]}},\"identity\":{\"principalId\":\"y\",\"tenantId\":\"kbfkg\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"fjpgddtocjjxhvp\":{\"principalId\":\"xxppofm\",\"clientId\":\"x\"},\"deicbtwnpzao\":{\"principalId\":\"uexhdzx\",\"clientId\":\"qeojnxqbzvddntw\"}}},\"location\":\"uhrhcffcyddgl\",\"tags\":{\"wpyeicxmqciwqvh\":\"hjq\"},\"id\":\"hix\",\"name\":\"igdtopbob\",\"type\":\"og\"}],\"nextLink\":\"e\"}") + .toObject(OrganizationResourceListResult.class); + Assertions.assertEquals("uhrhcffcyddgl", model.value().get(0).location()); + Assertions.assertEquals("hjq", model.value().get(0).tags().get("wpyeicxmqciwqvh")); + Assertions.assertEquals("nb", model.value().get(0).properties().marketplace().subscriptionId()); + Assertions.assertEquals("abnmocpcyshu", + model.value().get(0).properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("zafb", model.value().get(0).properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("jjgpb", model.value().get(0).properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("qcjm", model.value().get(0).properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("javbqidtqajz", + model.value().get(0).properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("l", model.value().get(0).properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("kudjkrlkhb", model.value().get(0).properties().user().firstName()); + Assertions.assertEquals("hfepgzgqex", model.value().get(0).properties().user().lastName()); + Assertions.assertEquals("locx", model.value().get(0).properties().user().emailAddress()); + Assertions.assertEquals("paierh", model.value().get(0).properties().user().upn()); + Assertions.assertEquals("csglum", model.value().get(0).properties().user().phoneNumber()); + Assertions.assertEquals("j", model.value().get(0).properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.SAML, + model.value().get(0).properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, + model.value().get(0).properties().singleSignOnProperties().state()); + Assertions.assertEquals("nbdxk", model.value().get(0).properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("xo", model.value().get(0).properties().singleSignOnProperties().url()); + Assertions.assertEquals("ionpimexg", + model.value().get(0).properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals("e", model.nextLink()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceUpdateTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceUpdateTests.java new file mode 100644 index 0000000000000..aa7f050819080 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationResourceUpdateTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResourceUpdate; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceUpdate model = BinaryData.fromString( + "{\"tags\":{\"szdnr\":\"rbnwbxgjvtbvpy\",\"uhmuouqfprwzwbn\":\"jq\",\"a\":\"uitnwuiz\",\"fizuckyf\":\"x\"},\"identity\":{\"principalId\":\"fidfvzw\",\"tenantId\":\"uht\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"ufufsrp\":{\"principalId\":\"dkfthwxmnt\",\"clientId\":\"waopvkmijcmmxd\"},\"mdwzjeiachboo\":{\"principalId\":\"zidnsezcxtbzsgfy\",\"clientId\":\"sne\"},\"inpvswjdkirsoodq\":{\"principalId\":\"lnrosfqp\",\"clientId\":\"ehzzvypyqrim\"},\"znorcj\":{\"principalId\":\"crmnohjtckwhds\",\"clientId\":\"fiyipjxsqwpgrj\"}}}}") + .toObject(OrganizationResourceUpdate.class); + Assertions.assertEquals("rbnwbxgjvtbvpy", model.tags().get("szdnr")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceUpdate model = new OrganizationResourceUpdate() + .withTags(mapOf("szdnr", "rbnwbxgjvtbvpy", "uhmuouqfprwzwbn", "jq", "a", "uitnwuiz", "fizuckyf", "x")) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("ufufsrp", new UserAssignedIdentity(), "mdwzjeiachboo", new UserAssignedIdentity(), + "inpvswjdkirsoodq", new UserAssignedIdentity(), "znorcj", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(OrganizationResourceUpdate.class); + Assertions.assertEquals("rbnwbxgjvtbvpy", model.tags().get("szdnr")); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsCreateOrUpdateMockTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..f88fa832569e4 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsCreateOrUpdateMockTests.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentity; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.MarketplaceDetails; +import com.azure.resourcemanager.pineconevectordb.models.OfferDetails; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationProperties; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.PartnerProperties; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnPropertiesV2; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; +import com.azure.resourcemanager.pineconevectordb.models.UserDetails; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OrganizationsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"marketplace\":{\"subscriptionId\":\"dqmh\",\"subscriptionStatus\":\"Suspended\",\"offerDetails\":{\"publisherId\":\"htldwk\",\"offerId\":\"zxuutkncwscwsvl\",\"planId\":\"otogtwrupqs\",\"planName\":\"nmic\",\"termUnit\":\"vce\",\"termId\":\"eil\"}},\"user\":{\"firstName\":\"vnotyfjfcnj\",\"lastName\":\"k\",\"emailAddress\":\"nxdhbt\",\"upn\":\"phywpnvj\",\"phoneNumber\":\"qnermclfplphoxu\"},\"provisioningState\":\"Succeeded\",\"partnerProperties\":{\"displayName\":\"abgy\"},\"singleSignOnProperties\":{\"type\":\"Saml\",\"state\":\"Initial\",\"enterpriseAppId\":\"azqugxywpmueefj\",\"url\":\"fqkquj\",\"aadDomains\":[\"uyonobglaoc\",\"xtccmg\",\"udxytlmoyrx\",\"wfudwpzntxhdzhl\"]}},\"identity\":{\"principalId\":\"bh\",\"tenantId\":\"frlh\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"ehhseyvjusrts\":{\"principalId\":\"yvpycanuzbpzk\",\"clientId\":\"kuwbcrnwb\"},\"ahvljuaha\":{\"principalId\":\"spkdee\",\"clientId\":\"ofmxagkvtmelmqkr\"}}},\"location\":\"hcdhmdual\",\"tags\":{\"adm\":\"qpv\",\"r\":\"sr\",\"fmisg\":\"vxpvgomz\"},\"id\":\"bnbbeldawkz\",\"name\":\"ali\",\"type\":\"urqhaka\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PineconeVectorDbManager manager = PineconeVectorDbManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + OrganizationResource response = manager.organizations() + .define("mpvecxgodebfqk") + .withRegion("bhvgy") + .withExistingResourceGroup("jhtxfvgxbfsmxne") + .withTags(mapOf("ss", "osvmk", "gmgsxnkjzkde", "qukkfp", "yighxpk", "lpvlopw", "baumnyqupedeoj", "wzbaiue")) + .withProperties(new OrganizationProperties() + .withMarketplace(new MarketplaceDetails().withSubscriptionId("bmpukgriwflz") + .withOfferDetails(new OfferDetails().withPublisherId("xzpuzycisp") + .withOfferId("qzahmgkbrp") + .withPlanId("y") + .withPlanName("ibnuqqkpik") + .withTermUnit("rgvtqag") + .withTermId("uynhijg"))) + .withUser(new UserDetails().withFirstName("mebf") + .withLastName("iarbutrcvpna") + .withEmailAddress("zmhjrunmp") + .withUpn("tdbhrbnla") + .withPhoneNumber("xmyskp")) + .withPartnerProperties(new PartnerProperties().withDisplayName("btkcxywnytnrsyn")) + .withSingleSignOnProperties(new SingleSignOnPropertiesV2().withType(SingleSignOnType.OPEN_ID) + .withState(SingleSignOnStates.DISABLE) + .withEnterpriseAppId("yxczfclh") + .withUrl("xdbabphlwr") + .withAadDomains(Arrays.asList("ktsthsucocmny")))) + .withIdentity( + new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("qwalmuzyoxaepd", new UserAssignedIdentity(), "zt", new UserAssignedIdentity(), + "xbzpfzab", new UserAssignedIdentity(), "iklbbovpl", new UserAssignedIdentity()))) + .create(); + + Assertions.assertEquals("hcdhmdual", response.location()); + Assertions.assertEquals("qpv", response.tags().get("adm")); + Assertions.assertEquals("dqmh", response.properties().marketplace().subscriptionId()); + Assertions.assertEquals("htldwk", response.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("zxuutkncwscwsvl", response.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("otogtwrupqs", response.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("nmic", response.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("vce", response.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("eil", response.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("vnotyfjfcnj", response.properties().user().firstName()); + Assertions.assertEquals("k", response.properties().user().lastName()); + Assertions.assertEquals("nxdhbt", response.properties().user().emailAddress()); + Assertions.assertEquals("phywpnvj", response.properties().user().upn()); + Assertions.assertEquals("qnermclfplphoxu", response.properties().user().phoneNumber()); + Assertions.assertEquals("abgy", response.properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.SAML, response.properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.INITIAL, response.properties().singleSignOnProperties().state()); + Assertions.assertEquals("azqugxywpmueefj", response.properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("fqkquj", response.properties().singleSignOnProperties().url()); + Assertions.assertEquals("uyonobglaoc", response.properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.identity().type()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsGetByResourceGroupWithResponseMockTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..8b3a22ce754e9 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +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 OrganizationsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"marketplace\":{\"subscriptionId\":\"kanyktzlcuiywg\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"gndrvynh\",\"offerId\":\"gpphrcgyn\",\"planId\":\"ocpecfvmmco\",\"planName\":\"sxlzevgbmqj\",\"termUnit\":\"bcypmi\",\"termId\":\"w\"}},\"user\":{\"firstName\":\"zuvccfwnfnbacfio\",\"lastName\":\"l\",\"emailAddress\":\"bxetqgtzxdpn\",\"upn\":\"qqwx\",\"phoneNumber\":\"feallnwsu\"},\"provisioningState\":\"Failed\",\"partnerProperties\":{\"displayName\":\"jampmngnzscxaqw\"},\"singleSignOnProperties\":{\"type\":\"OpenId\",\"state\":\"Enable\",\"enterpriseAppId\":\"onq\",\"url\":\"kvlrxnj\",\"aadDomains\":[\"eipheoflokeyy\",\"enjbdlwtgrhp\"]}},\"identity\":{\"principalId\":\"jumasx\",\"tenantId\":\"jpqyegu\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"pwlbjnpg\":{\"principalId\":\"xhejjzzvdud\",\"clientId\":\"dslfhotwmcy\"}}},\"location\":\"ftadehxnltyfs\",\"tags\":{\"nzwdejba\":\"usue\",\"xdn\":\"orxzdmohctbqvud\"},\"id\":\"nvowgujju\",\"name\":\"wdkcglhsl\",\"type\":\"zj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PineconeVectorDbManager manager = PineconeVectorDbManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + OrganizationResource response = manager.organizations() + .getByResourceGroupWithResponse("rvqdra", "hjybigehoqfbo", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ftadehxnltyfs", response.location()); + Assertions.assertEquals("usue", response.tags().get("nzwdejba")); + Assertions.assertEquals("kanyktzlcuiywg", response.properties().marketplace().subscriptionId()); + Assertions.assertEquals("gndrvynh", response.properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("gpphrcgyn", response.properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("ocpecfvmmco", response.properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("sxlzevgbmqj", response.properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("bcypmi", response.properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("w", response.properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("zuvccfwnfnbacfio", response.properties().user().firstName()); + Assertions.assertEquals("l", response.properties().user().lastName()); + Assertions.assertEquals("bxetqgtzxdpn", response.properties().user().emailAddress()); + Assertions.assertEquals("qqwx", response.properties().user().upn()); + Assertions.assertEquals("feallnwsu", response.properties().user().phoneNumber()); + Assertions.assertEquals("jampmngnzscxaqw", response.properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.OPEN_ID, response.properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, response.properties().singleSignOnProperties().state()); + Assertions.assertEquals("onq", response.properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("kvlrxnj", response.properties().singleSignOnProperties().url()); + Assertions.assertEquals("eipheoflokeyy", response.properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, response.identity().type()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListByResourceGroupMockTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..25e2bbef5925d --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListByResourceGroupMockTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +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 OrganizationsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"marketplace\":{\"subscriptionId\":\"uofqwe\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"menevfyexfwh\",\"offerId\":\"bcibvyvdcsitynn\",\"planId\":\"amdecte\",\"planName\":\"iqscjeypv\",\"termUnit\":\"zrkgqhcjrefovg\",\"termId\":\"qsl\"}},\"user\":{\"firstName\":\"yyvxyqjpkcattpn\",\"lastName\":\"jcrcczsqpjhvmda\",\"emailAddress\":\"v\",\"upn\":\"sounqecanoaeu\",\"phoneNumber\":\"hy\"},\"provisioningState\":\"Succeeded\",\"partnerProperties\":{\"displayName\":\"pmopjmc\"},\"singleSignOnProperties\":{\"type\":\"Saml\",\"state\":\"Enable\",\"enterpriseAppId\":\"thfuiuaodsfcpkvx\",\"url\":\"puozmyzydag\",\"aadDomains\":[\"xbezyiuokktwh\",\"dxwzywqsmbsurexi\",\"o\"]}},\"identity\":{\"principalId\":\"cfsf\",\"tenantId\":\"ymddys\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"vkd\":{\"principalId\":\"xhqyudxorrqnb\",\"clientId\":\"czvyifq\"},\"ulexxbczwtr\":{\"principalId\":\"sllr\",\"clientId\":\"vdfwatkpn\"},\"zdobpxjmflbvvnch\":{\"principalId\":\"iqzbq\",\"clientId\":\"sovmyokacspkwl\"}}},\"location\":\"cciw\",\"tags\":{\"foskghsauuimj\":\"uqkhrsajiwku\"},\"id\":\"vxieduugidyj\",\"name\":\"rfbyaosvexcso\",\"type\":\"pclhocohslk\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PineconeVectorDbManager manager = PineconeVectorDbManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.organizations().listByResourceGroup("yggdtjixh", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("cciw", response.iterator().next().location()); + Assertions.assertEquals("uqkhrsajiwku", response.iterator().next().tags().get("foskghsauuimj")); + Assertions.assertEquals("uofqwe", response.iterator().next().properties().marketplace().subscriptionId()); + Assertions.assertEquals("menevfyexfwh", + response.iterator().next().properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("bcibvyvdcsitynn", + response.iterator().next().properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("amdecte", + response.iterator().next().properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("iqscjeypv", + response.iterator().next().properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("zrkgqhcjrefovg", + response.iterator().next().properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("qsl", response.iterator().next().properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("yyvxyqjpkcattpn", response.iterator().next().properties().user().firstName()); + Assertions.assertEquals("jcrcczsqpjhvmda", response.iterator().next().properties().user().lastName()); + Assertions.assertEquals("v", response.iterator().next().properties().user().emailAddress()); + Assertions.assertEquals("sounqecanoaeu", response.iterator().next().properties().user().upn()); + Assertions.assertEquals("hy", response.iterator().next().properties().user().phoneNumber()); + Assertions.assertEquals("pmopjmc", response.iterator().next().properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.SAML, + response.iterator().next().properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, + response.iterator().next().properties().singleSignOnProperties().state()); + Assertions.assertEquals("thfuiuaodsfcpkvx", + response.iterator().next().properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("puozmyzydag", response.iterator().next().properties().singleSignOnProperties().url()); + Assertions.assertEquals("xbezyiuokktwh", + response.iterator().next().properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, + response.iterator().next().identity().type()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListMockTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListMockTests.java new file mode 100644 index 0000000000000..f9ee5394265ac --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/OrganizationsListMockTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.pineconevectordb.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.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.pineconevectordb.PineconeVectorDbManager; +import com.azure.resourcemanager.pineconevectordb.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.pineconevectordb.models.OrganizationResource; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +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 OrganizationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"marketplace\":{\"subscriptionId\":\"leggzfbu\",\"subscriptionStatus\":\"Unsubscribed\",\"offerDetails\":{\"publisherId\":\"vfaxkffeiith\",\"offerId\":\"vmezy\",\"planId\":\"shxmzsbbzoggigrx\",\"planName\":\"ur\",\"termUnit\":\"xxjnspydptk\",\"termId\":\"nkoukn\"}},\"user\":{\"firstName\":\"udwtiukbl\",\"lastName\":\"ngkpocipazy\",\"emailAddress\":\"o\",\"upn\":\"ukgjnpiucgygevq\",\"phoneNumber\":\"typmrbpizcdrqjsd\"},\"provisioningState\":\"Succeeded\",\"partnerProperties\":{\"displayName\":\"fyhxde\"},\"singleSignOnProperties\":{\"type\":\"OpenId\",\"state\":\"Enable\",\"enterpriseAppId\":\"w\",\"url\":\"sjttgzfbish\",\"aadDomains\":[\"hajdeyeamdpha\"]}},\"identity\":{\"principalId\":\"pbuxwgipwhon\",\"tenantId\":\"kgshwa\",\"type\":\"None\",\"userAssignedIdentities\":{\"tmryw\":{\"principalId\":\"bin\",\"clientId\":\"pu\"},\"nwvlryavwhheunmm\":{\"principalId\":\"zoqftiyqzrnkcqvy\",\"clientId\":\"whzlsicohoq\"},\"conuqszfkbeype\":{\"principalId\":\"gyxzk\",\"clientId\":\"ocukoklyax\"}}},\"location\":\"mjmwvvjektcx\",\"tags\":{\"rzpwvlqdqgbiq\":\"hwlrsf\",\"vf\":\"lihkaetcktvfc\",\"xerf\":\"nkymuctqhjfbebrj\",\"phxepcyvahf\":\"wutttxfvjrbi\"},\"id\":\"ljkyqxjvuuj\",\"name\":\"gidokgjljyoxgvcl\",\"type\":\"bgsncghkjeszzhb\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PineconeVectorDbManager manager = PineconeVectorDbManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.organizations().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mjmwvvjektcx", response.iterator().next().location()); + Assertions.assertEquals("hwlrsf", response.iterator().next().tags().get("rzpwvlqdqgbiq")); + Assertions.assertEquals("leggzfbu", response.iterator().next().properties().marketplace().subscriptionId()); + Assertions.assertEquals("vfaxkffeiith", + response.iterator().next().properties().marketplace().offerDetails().publisherId()); + Assertions.assertEquals("vmezy", + response.iterator().next().properties().marketplace().offerDetails().offerId()); + Assertions.assertEquals("shxmzsbbzoggigrx", + response.iterator().next().properties().marketplace().offerDetails().planId()); + Assertions.assertEquals("ur", response.iterator().next().properties().marketplace().offerDetails().planName()); + Assertions.assertEquals("xxjnspydptk", + response.iterator().next().properties().marketplace().offerDetails().termUnit()); + Assertions.assertEquals("nkoukn", + response.iterator().next().properties().marketplace().offerDetails().termId()); + Assertions.assertEquals("udwtiukbl", response.iterator().next().properties().user().firstName()); + Assertions.assertEquals("ngkpocipazy", response.iterator().next().properties().user().lastName()); + Assertions.assertEquals("o", response.iterator().next().properties().user().emailAddress()); + Assertions.assertEquals("ukgjnpiucgygevq", response.iterator().next().properties().user().upn()); + Assertions.assertEquals("typmrbpizcdrqjsd", response.iterator().next().properties().user().phoneNumber()); + Assertions.assertEquals("fyhxde", response.iterator().next().properties().partnerProperties().displayName()); + Assertions.assertEquals(SingleSignOnType.OPEN_ID, + response.iterator().next().properties().singleSignOnProperties().type()); + Assertions.assertEquals(SingleSignOnStates.ENABLE, + response.iterator().next().properties().singleSignOnProperties().state()); + Assertions.assertEquals("w", + response.iterator().next().properties().singleSignOnProperties().enterpriseAppId()); + Assertions.assertEquals("sjttgzfbish", response.iterator().next().properties().singleSignOnProperties().url()); + Assertions.assertEquals("hajdeyeamdpha", + response.iterator().next().properties().singleSignOnProperties().aadDomains().get(0)); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/PartnerPropertiesTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/PartnerPropertiesTests.java new file mode 100644 index 0000000000000..6a667071240e8 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/PartnerPropertiesTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.PartnerProperties; +import org.junit.jupiter.api.Assertions; + +public final class PartnerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PartnerProperties model + = BinaryData.fromString("{\"displayName\":\"dmgloug\"}").toObject(PartnerProperties.class); + Assertions.assertEquals("dmgloug", model.displayName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PartnerProperties model = new PartnerProperties().withDisplayName("dmgloug"); + model = BinaryData.fromObject(model).toObject(PartnerProperties.class); + Assertions.assertEquals("dmgloug", model.displayName()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/SingleSignOnPropertiesV2Tests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/SingleSignOnPropertiesV2Tests.java new file mode 100644 index 0000000000000..7f65174851575 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/SingleSignOnPropertiesV2Tests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnPropertiesV2; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnStates; +import com.azure.resourcemanager.pineconevectordb.models.SingleSignOnType; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class SingleSignOnPropertiesV2Tests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SingleSignOnPropertiesV2 model = BinaryData.fromString( + "{\"type\":\"Saml\",\"state\":\"Disable\",\"enterpriseAppId\":\"mutduqktaps\",\"url\":\"gcue\",\"aadDomains\":[\"mkdo\",\"vqwhbmdgbbjfd\",\"gmbmbexppbh\",\"q\"]}") + .toObject(SingleSignOnPropertiesV2.class); + Assertions.assertEquals(SingleSignOnType.SAML, model.type()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, model.state()); + Assertions.assertEquals("mutduqktaps", model.enterpriseAppId()); + Assertions.assertEquals("gcue", model.url()); + Assertions.assertEquals("mkdo", model.aadDomains().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SingleSignOnPropertiesV2 model = new SingleSignOnPropertiesV2().withType(SingleSignOnType.SAML) + .withState(SingleSignOnStates.DISABLE) + .withEnterpriseAppId("mutduqktaps") + .withUrl("gcue") + .withAadDomains(Arrays.asList("mkdo", "vqwhbmdgbbjfd", "gmbmbexppbh", "q")); + model = BinaryData.fromObject(model).toObject(SingleSignOnPropertiesV2.class); + Assertions.assertEquals(SingleSignOnType.SAML, model.type()); + Assertions.assertEquals(SingleSignOnStates.DISABLE, model.state()); + Assertions.assertEquals("mutduqktaps", model.enterpriseAppId()); + Assertions.assertEquals("gcue", model.url()); + Assertions.assertEquals("mkdo", model.aadDomains().get(0)); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/UserAssignedIdentityTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/UserAssignedIdentityTests.java new file mode 100644 index 0000000000000..4ebf4f8b833c3 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/UserAssignedIdentityTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = BinaryData.fromString("{\"principalId\":\"l\",\"clientId\":\"uvfqawrlyxwj\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/UserDetailsTests.java b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/UserDetailsTests.java new file mode 100644 index 0000000000000..fd59833eca88c --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/src/test/java/com/azure/resourcemanager/pineconevectordb/generated/UserDetailsTests.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.pineconevectordb.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.pineconevectordb.models.UserDetails; +import org.junit.jupiter.api.Assertions; + +public final class UserDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserDetails model = BinaryData.fromString( + "{\"firstName\":\"yqkgfg\",\"lastName\":\"bmadgak\",\"emailAddress\":\"qsrxybzqqed\",\"upn\":\"tbciqfouflmm\",\"phoneNumber\":\"zsm\"}") + .toObject(UserDetails.class); + Assertions.assertEquals("yqkgfg", model.firstName()); + Assertions.assertEquals("bmadgak", model.lastName()); + Assertions.assertEquals("qsrxybzqqed", model.emailAddress()); + Assertions.assertEquals("tbciqfouflmm", model.upn()); + Assertions.assertEquals("zsm", model.phoneNumber()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserDetails model = new UserDetails().withFirstName("yqkgfg") + .withLastName("bmadgak") + .withEmailAddress("qsrxybzqqed") + .withUpn("tbciqfouflmm") + .withPhoneNumber("zsm"); + model = BinaryData.fromObject(model).toObject(UserDetails.class); + Assertions.assertEquals("yqkgfg", model.firstName()); + Assertions.assertEquals("bmadgak", model.lastName()); + Assertions.assertEquals("qsrxybzqqed", model.emailAddress()); + Assertions.assertEquals("tbciqfouflmm", model.upn()); + Assertions.assertEquals("zsm", model.phoneNumber()); + } +} diff --git a/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/tsp-location.yaml b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/tsp-location.yaml new file mode 100644 index 0000000000000..2e91a7d0e3b49 --- /dev/null +++ b/sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrpinecone/Pinecone.VectorDb.Management +commit: 85502e6f88d5c8856a8ad1b0dc55c7adcefc836d +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/pineconevectordb/ci.yml b/sdk/pineconevectordb/ci.yml new file mode 100644 index 0000000000000..b32d56ae31d99 --- /dev/null +++ b/sdk/pineconevectordb/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/pineconevectordb/ci.yml + - sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/ + exclude: + - sdk/pineconevectordb/pom.xml + - sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/pineconevectordb/ci.yml + - sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/ + exclude: + - sdk/pineconevectordb/pom.xml + - sdk/pineconevectordb/azure-resourcemanager-pineconevectordb/pom.xml + +parameters: + - name: release_azureresourcemanagerpineconevectordb + displayName: azure-resourcemanager-pineconevectordb + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: pineconevectordb + Artifacts: + - name: azure-resourcemanager-pineconevectordb + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpineconevectordb + releaseInBatch: ${{ parameters.release_azureresourcemanagerpineconevectordb }} diff --git a/sdk/pineconevectordb/pom.xml b/sdk/pineconevectordb/pom.xml new file mode 100644 index 0000000000000..45830a9448f86 --- /dev/null +++ b/sdk/pineconevectordb/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-pineconevectordb-service + pom + 1.0.0 + + + azure-resourcemanager-pineconevectordb + +