diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 9099899ed75d0..217d0165009df 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -331,6 +331,7 @@ com.azure.resourcemanager:azure-resourcemanager-desktopvirtualization;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-loadtestservice;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-automanage;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-edgeorder;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-powerbiembedded;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.0.0 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current diff --git a/pom.xml b/pom.xml index aab77f33ebeb9..ad465d55ad990 100644 --- a/pom.xml +++ b/pom.xml @@ -809,6 +809,7 @@ sdk/postgresql sdk/postgresqlflexibleserver sdk/powerbidedicated + sdk/powerbiembedded sdk/purview sdk/quantum sdk/quota diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/CHANGELOG.md b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/CHANGELOG.md new file mode 100644 index 0000000000000..4ae612ecb3adc --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-01-05) + +- Azure Resource Manager PowerBIEmbedded client library for Java. This package contains Microsoft Azure SDK for PowerBIEmbedded Management SDK. Client to manage your Power BI Embedded workspace collections and retrieve workspaces. Package tag package-2016-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/README.md b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/README.md new file mode 100644 index 0000000000000..3e8cdeb217edf --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager PowerBIEmbedded client library for Java + +Azure Resource Manager PowerBIEmbedded client library for Java. + +This package contains Microsoft Azure SDK for PowerBIEmbedded Management SDK. Client to manage your Power BI Embedded workspace collections and retrieve workspaces. Package tag package-2016-01. 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-powerbiembedded;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-powerbiembedded + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +PowerBIEmbeddedManager manager = PowerBIEmbeddedManager + .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/powerbiembedded/azure-resourcemanager-powerbiembedded/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/SAMPLE.md b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/SAMPLE.md new file mode 100644 index 0000000000000..77e24ff3efbda --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/SAMPLE.md @@ -0,0 +1,2 @@ +# Code snippets and samples + diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/pom.xml b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/pom.xml new file mode 100644 index 0000000000000..3b4ac096b6bb3 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/pom.xml @@ -0,0 +1,81 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-powerbiembedded + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for PowerBIEmbedded Management + This package contains Microsoft Azure SDK for PowerBIEmbedded Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Client to manage your Power BI Embedded workspace collections and retrieve workspaces. Package tag package-2016-01. + 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 + true + false + + + + + + com.azure + azure-core + 1.23.1 + + + com.azure + azure-core-management + 1.4.4 + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/PowerBIEmbeddedManager.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/PowerBIEmbeddedManager.java new file mode 100644 index 0000000000000..d60812d56f22a --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/PowerBIEmbeddedManager.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded; + +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.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.fluent.PowerBIEmbeddedManagementClient; +import com.azure.resourcemanager.powerbiembedded.implementation.PowerBIEmbeddedManagementClientBuilder; +import com.azure.resourcemanager.powerbiembedded.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.powerbiembedded.implementation.WorkspaceCollectionsImpl; +import com.azure.resourcemanager.powerbiembedded.implementation.WorkspacesImpl; +import com.azure.resourcemanager.powerbiembedded.models.ResourceProviders; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollections; +import com.azure.resourcemanager.powerbiembedded.models.Workspaces; +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 PowerBIEmbeddedManager. Client to manage your Power BI Embedded workspace collections and retrieve + * workspaces. + */ +public final class PowerBIEmbeddedManager { + private WorkspaceCollections workspaceCollections; + + private ResourceProviders resourceProviders; + + private Workspaces workspaces; + + private final PowerBIEmbeddedManagementClient clientObject; + + private PowerBIEmbeddedManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new PowerBIEmbeddedManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of PowerBIEmbedded service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PowerBIEmbedded service API instance. + */ + public static PowerBIEmbeddedManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create PowerBIEmbeddedManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new PowerBIEmbeddedManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of PowerBIEmbedded service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the PowerBIEmbedded service API instance. + */ + public PowerBIEmbeddedManager 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.powerbiembedded") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new PowerBIEmbeddedManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of WorkspaceCollections. */ + public WorkspaceCollections workspaceCollections() { + if (this.workspaceCollections == null) { + this.workspaceCollections = new WorkspaceCollectionsImpl(clientObject.getWorkspaceCollections(), this); + } + return workspaceCollections; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of Workspaces. */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(clientObject.getWorkspaces(), this); + } + return workspaces; + } + + /** + * @return Wrapped service client PowerBIEmbeddedManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public PowerBIEmbeddedManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/PowerBIEmbeddedManagementClient.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/PowerBIEmbeddedManagementClient.java new file mode 100644 index 0000000000000..7a4297121d343 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/PowerBIEmbeddedManagementClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for PowerBIEmbeddedManagementClient class. */ +public interface PowerBIEmbeddedManagementClient { + /** + * Gets Gets subscription credentials which uniquely identify a Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the WorkspaceCollectionsClient object to access its operations. + * + * @return the WorkspaceCollectionsClient object. + */ + WorkspaceCollectionsClient getWorkspaceCollections(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + WorkspacesClient getWorkspaces(); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/ResourceProvidersClient.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..b2f81e3f616a5 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/ResourceProvidersClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerbiembedded.fluent.models.OperationListInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListInner getAvailableOperations(); + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAvailableOperationsWithResponse(Context context); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/WorkspaceCollectionsClient.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/WorkspaceCollectionsClient.java new file mode 100644 index 0000000000000..613a277850695 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/WorkspaceCollectionsClient.java @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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.powerbiembedded.fluent.models.CheckNameResponseInner; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionAccessKeysInner; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameRequest; +import com.azure.resourcemanager.powerbiembedded.models.CreateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.MigrateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.UpdateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKey; + +/** An instance of this class provides access to all the operations defined in WorkspaceCollectionsClient. */ +public interface WorkspaceCollectionsClient { + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceCollectionInner getByResourceGroup(String resourceGroupName, String workspaceCollectionName); + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceCollectionInner create( + String resourceGroupName, String workspaceCollectionName, CreateWorkspaceCollectionRequest body); + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String workspaceCollectionName, + CreateWorkspaceCollectionRequest body, + Context context); + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceCollectionInner update( + String resourceGroupName, String workspaceCollectionName, UpdateWorkspaceCollectionRequest body); + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String workspaceCollectionName, + UpdateWorkspaceCollectionRequest body, + Context context); + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceCollectionName); + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceCollectionName); + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameResponseInner checkNameAvailability(String location, CheckNameRequest body); + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkNameAvailabilityWithResponse( + String location, CheckNameRequest body, Context context); + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceCollectionAccessKeysInner getAccessKeys(String resourceGroupName, String workspaceCollectionName); + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getAccessKeysWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceCollectionAccessKeysInner regenerateKey( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body); + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response regenerateKeyWithResponse( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body, Context context); + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void migrate(String resourceGroupName, MigrateWorkspaceCollectionRequest body); + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response migrateWithResponse( + String resourceGroupName, MigrateWorkspaceCollectionRequest body, Context context); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/WorkspacesClient.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/WorkspacesClient.java new file mode 100644 index 0000000000000..65641bf8cca76 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/WorkspacesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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.powerbiembedded.fluent.models.WorkspaceInner; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public interface WorkspacesClient { + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceCollectionName); + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String workspaceCollectionName, Context context); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/CheckNameResponseInner.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/CheckNameResponseInner.java new file mode 100644 index 0000000000000..7db0c549a305d --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/CheckNameResponseInner.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameReason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CheckNameResponse model. */ +@Fluent +public final class CheckNameResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameResponseInner.class); + + /* + * Specifies a Boolean value that indicates whether the specified Power BI + * Workspace Collection name is available to use. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Reason why the workspace collection name cannot be used. + */ + @JsonProperty(value = "reason") + private CheckNameReason reason; + + /* + * Message indicating an unavailable name due to a conflict, or a + * description of the naming rules that are violated. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the nameAvailable property: Specifies a Boolean value that indicates whether the specified Power BI Workspace + * Collection name is available to use. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Specifies a Boolean value that indicates whether the specified Power BI Workspace + * Collection name is available to use. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameResponseInner object itself. + */ + public CheckNameResponseInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Reason why the workspace collection name cannot be used. + * + * @return the reason value. + */ + public CheckNameReason reason() { + return this.reason; + } + + /** + * Set the reason property: Reason why the workspace collection name cannot be used. + * + * @param reason the reason value to set. + * @return the CheckNameResponseInner object itself. + */ + public CheckNameResponseInner withReason(CheckNameReason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: Message indicating an unavailable name due to a conflict, or a description of the + * naming rules that are violated. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Message indicating an unavailable name due to a conflict, or a description of the + * naming rules that are violated. + * + * @param message the message value to set. + * @return the CheckNameResponseInner object itself. + */ + public CheckNameResponseInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/OperationListInner.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/OperationListInner.java new file mode 100644 index 0000000000000..80dc54fb02060 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/OperationListInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The OperationList model. */ +@Fluent +public final class OperationListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListInner.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the OperationListInner object itself. + */ + public OperationListInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceCollectionAccessKeysInner.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceCollectionAccessKeysInner.java new file mode 100644 index 0000000000000..8d2db1c52a80f --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceCollectionAccessKeysInner.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The WorkspaceCollectionAccessKeys model. */ +@Fluent +public final class WorkspaceCollectionAccessKeysInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceCollectionAccessKeysInner.class); + + /* + * Access key 1 + */ + @JsonProperty(value = "key1") + private String key1; + + /* + * Access key 2 + */ + @JsonProperty(value = "key2") + private String key2; + + /** + * Get the key1 property: Access key 1. + * + * @return the key1 value. + */ + public String key1() { + return this.key1; + } + + /** + * Set the key1 property: Access key 1. + * + * @param key1 the key1 value to set. + * @return the WorkspaceCollectionAccessKeysInner object itself. + */ + public WorkspaceCollectionAccessKeysInner withKey1(String key1) { + this.key1 = key1; + return this; + } + + /** + * Get the key2 property: Access key 2. + * + * @return the key2 value. + */ + public String key2() { + return this.key2; + } + + /** + * Set the key2 property: Access key 2. + * + * @param key2 the key2 value to set. + * @return the WorkspaceCollectionAccessKeysInner object itself. + */ + public WorkspaceCollectionAccessKeysInner withKey2(String key2) { + this.key2 = key2; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceCollectionInner.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceCollectionInner.java new file mode 100644 index 0000000000000..1a67e76760986 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceCollectionInner.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.models.AzureSku; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The WorkspaceCollection model. */ +@Fluent +public final class WorkspaceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceCollectionInner.class); + + /* + * Resource id + */ + @JsonProperty(value = "id") + private String id; + + /* + * Workspace collection name + */ + @JsonProperty(value = "name") + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type") + private String type; + + /* + * Azure location + */ + @JsonProperty(value = "location") + private String location; + + /* + * Dictionary of + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The sku property. + */ + @JsonProperty(value = "sku") + private AzureSku sku; + + /* + * Properties + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the id property: Resource id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id. + * + * @param id the id value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Workspace collection name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Workspace collection name. + * + * @param name the name value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Resource type. + * + * @param type the type value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the location property: Azure location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Azure location. + * + * @param location the location value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Dictionary of <string>. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of <string>. + * + * @param tags the tags value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: The sku property. + * + * @return the sku value. + */ + public AzureSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku property. + * + * @param sku the sku value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withSku(AzureSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: Properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Properties. + * + * @param properties the properties value to set. + * @return the WorkspaceCollectionInner object itself. + */ + public WorkspaceCollectionInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceInner.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceInner.java new file mode 100644 index 0000000000000..e67d619e44e78 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/WorkspaceInner.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Workspace model. */ +@Fluent +public final class WorkspaceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceInner.class); + + /* + * Workspace id + */ + @JsonProperty(value = "id") + private String id; + + /* + * Workspace name + */ + @JsonProperty(value = "name") + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type") + private String type; + + /* + * Property bag + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the id property: Workspace id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Workspace id. + * + * @param id the id value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Workspace name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Workspace name. + * + * @param name the name value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Resource type. + * + * @param type the type value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the properties property: Property bag. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Property bag. + * + * @param properties the properties value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/package-info.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/package-info.java new file mode 100644 index 0000000000000..9e485fb44804a --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for PowerBIEmbeddedManagementClient. Client to manage your Power BI Embedded + * workspace collections and retrieve workspaces. + */ +package com.azure.resourcemanager.powerbiembedded.fluent.models; diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/package-info.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/package-info.java new file mode 100644 index 0000000000000..67fe6171218d8 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for PowerBIEmbeddedManagementClient. Client to manage your Power BI Embedded + * workspace collections and retrieve workspaces. + */ +package com.azure.resourcemanager.powerbiembedded.fluent; diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/CheckNameResponseImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/CheckNameResponseImpl.java new file mode 100644 index 0000000000000..136b07f459b27 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/CheckNameResponseImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.CheckNameResponseInner; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameReason; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameResponse; + +public final class CheckNameResponseImpl implements CheckNameResponse { + private CheckNameResponseInner innerObject; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + CheckNameResponseImpl( + CheckNameResponseInner innerObject, + com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public CheckNameReason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/OperationListImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/OperationListImpl.java new file mode 100644 index 0000000000000..5130ee06e458d --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/OperationListImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.OperationListInner; +import com.azure.resourcemanager.powerbiembedded.models.Operation; +import com.azure.resourcemanager.powerbiembedded.models.OperationList; +import java.util.Collections; +import java.util.List; + +public final class OperationListImpl implements OperationList { + private OperationListInner innerObject; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + OperationListImpl( + OperationListInner innerObject, + com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OperationListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/PowerBIEmbeddedManagementClientBuilder.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/PowerBIEmbeddedManagementClientBuilder.java new file mode 100644 index 0000000000000..7312e015ea85c --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/PowerBIEmbeddedManagementClientBuilder.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the PowerBIEmbeddedManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {PowerBIEmbeddedManagementClientImpl.class}) +public final class PowerBIEmbeddedManagementClientBuilder { + /* + * Gets subscription credentials which uniquely identify a Microsoft Azure + * subscription. The subscription ID forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Gets subscription credentials which uniquely identify a Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the PowerBIEmbeddedManagementClientBuilder. + */ + public PowerBIEmbeddedManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the PowerBIEmbeddedManagementClientBuilder. + */ + public PowerBIEmbeddedManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the PowerBIEmbeddedManagementClientBuilder. + */ + public PowerBIEmbeddedManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the PowerBIEmbeddedManagementClientBuilder. + */ + public PowerBIEmbeddedManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the PowerBIEmbeddedManagementClientBuilder. + */ + public PowerBIEmbeddedManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the PowerBIEmbeddedManagementClientBuilder. + */ + public PowerBIEmbeddedManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of PowerBIEmbeddedManagementClientImpl with the provided parameters. + * + * @return an instance of PowerBIEmbeddedManagementClientImpl. + */ + public PowerBIEmbeddedManagementClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + PowerBIEmbeddedManagementClientImpl client = + new PowerBIEmbeddedManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/PowerBIEmbeddedManagementClientImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/PowerBIEmbeddedManagementClientImpl.java new file mode 100644 index 0000000000000..6ee0dbfcc94df --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/PowerBIEmbeddedManagementClientImpl.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.powerbiembedded.fluent.PowerBIEmbeddedManagementClient; +import com.azure.resourcemanager.powerbiembedded.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.powerbiembedded.fluent.WorkspaceCollectionsClient; +import com.azure.resourcemanager.powerbiembedded.fluent.WorkspacesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the PowerBIEmbeddedManagementClientImpl type. */ +@ServiceClient(builder = PowerBIEmbeddedManagementClientBuilder.class) +public final class PowerBIEmbeddedManagementClientImpl implements PowerBIEmbeddedManagementClient { + private final ClientLogger logger = new ClientLogger(PowerBIEmbeddedManagementClientImpl.class); + + /** + * Gets subscription credentials which uniquely identify a Microsoft Azure subscription. The subscription ID forms + * part of the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Gets subscription credentials which uniquely identify a Microsoft Azure subscription. The subscription ID + * forms part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The WorkspaceCollectionsClient object to access its operations. */ + private final WorkspaceCollectionsClient workspaceCollections; + + /** + * Gets the WorkspaceCollectionsClient object to access its operations. + * + * @return the WorkspaceCollectionsClient object. + */ + public WorkspaceCollectionsClient getWorkspaceCollections() { + return this.workspaceCollections; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The WorkspacesClient object to access its operations. */ + private final WorkspacesClient workspaces; + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + public WorkspacesClient getWorkspaces() { + return this.workspaces; + } + + /** + * Initializes an instance of PowerBIEmbeddedManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Gets subscription credentials which uniquely identify a Microsoft Azure subscription. The + * subscription ID forms part of the URI for every service call. + * @param endpoint server parameter. + */ + PowerBIEmbeddedManagementClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2016-01-29"; + this.workspaceCollections = new WorkspaceCollectionsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.workspaces = new WorkspacesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/ResourceProvidersClientImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..9895c7485615e --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.powerbiembedded.fluent.models.OperationListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final PowerBIEmbeddedManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(PowerBIEmbeddedManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerBIEmbeddedManagementClientResourceProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerBIEmbeddedManag") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.PowerBI/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAvailableOperations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAvailableOperationsWithResponseAsync() { + 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 + .getAvailableOperations( + this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAvailableOperationsWithResponseAsync(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.getAvailableOperations(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAvailableOperationsAsync() { + return getAvailableOperationsWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListInner getAvailableOperations() { + return getAvailableOperationsAsync().block(); + } + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAvailableOperationsWithResponse(Context context) { + return getAvailableOperationsWithResponseAsync(context).block(); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/ResourceProvidersImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..1a2ae0956ba51 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/ResourceProvidersImpl.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.powerbiembedded.fluent.models.OperationListInner; +import com.azure.resourcemanager.powerbiembedded.models.OperationList; +import com.azure.resourcemanager.powerbiembedded.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationList getAvailableOperations() { + OperationListInner inner = this.serviceClient().getAvailableOperations(); + if (inner != null) { + return new OperationListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAvailableOperationsWithResponse(Context context) { + Response inner = this.serviceClient().getAvailableOperationsWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/Utils.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/Utils.java new file mode 100644 index 0000000000000..6240b58c40922 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionAccessKeysImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionAccessKeysImpl.java new file mode 100644 index 0000000000000..79a21c5c72fd8 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionAccessKeysImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionAccessKeysInner; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKeys; + +public final class WorkspaceCollectionAccessKeysImpl implements WorkspaceCollectionAccessKeys { + private WorkspaceCollectionAccessKeysInner innerObject; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + WorkspaceCollectionAccessKeysImpl( + WorkspaceCollectionAccessKeysInner innerObject, + com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String key1() { + return this.innerModel().key1(); + } + + public String key2() { + return this.innerModel().key2(); + } + + public WorkspaceCollectionAccessKeysInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionImpl.java new file mode 100644 index 0000000000000..35966bd869d1a --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionImpl.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner; +import com.azure.resourcemanager.powerbiembedded.models.AzureSku; +import com.azure.resourcemanager.powerbiembedded.models.CreateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.UpdateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollection; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKey; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKeys; +import java.util.Collections; +import java.util.Map; + +public final class WorkspaceCollectionImpl + implements WorkspaceCollection, WorkspaceCollection.Definition, WorkspaceCollection.Update { + private WorkspaceCollectionInner innerObject; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager 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 AzureSku sku() { + return this.innerModel().sku(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public WorkspaceCollectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceCollectionName; + + private CreateWorkspaceCollectionRequest createBody; + + private UpdateWorkspaceCollectionRequest updateBody; + + public WorkspaceCollectionImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public WorkspaceCollection create() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceCollections() + .createWithResponse(resourceGroupName, workspaceCollectionName, createBody, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceCollection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceCollections() + .createWithResponse(resourceGroupName, workspaceCollectionName, createBody, context) + .getValue(); + return this; + } + + WorkspaceCollectionImpl( + String name, com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerObject = new WorkspaceCollectionInner(); + this.serviceManager = serviceManager; + this.workspaceCollectionName = name; + this.createBody = new CreateWorkspaceCollectionRequest(); + } + + public WorkspaceCollectionImpl update() { + this.updateBody = new UpdateWorkspaceCollectionRequest(); + return this; + } + + public WorkspaceCollection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceCollections() + .updateWithResponse(resourceGroupName, workspaceCollectionName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceCollection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceCollections() + .updateWithResponse(resourceGroupName, workspaceCollectionName, updateBody, context) + .getValue(); + return this; + } + + WorkspaceCollectionImpl( + WorkspaceCollectionInner innerObject, + com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceCollectionName = Utils.getValueFromIdByName(innerObject.id(), "workspaceCollections"); + } + + public WorkspaceCollection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceCollections() + .getByResourceGroupWithResponse(resourceGroupName, workspaceCollectionName, Context.NONE) + .getValue(); + return this; + } + + public WorkspaceCollection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getWorkspaceCollections() + .getByResourceGroupWithResponse(resourceGroupName, workspaceCollectionName, context) + .getValue(); + return this; + } + + public WorkspaceCollectionAccessKeys getAccessKeys() { + return serviceManager.workspaceCollections().getAccessKeys(resourceGroupName, workspaceCollectionName); + } + + public Response getAccessKeysWithResponse(Context context) { + return serviceManager + .workspaceCollections() + .getAccessKeysWithResponse(resourceGroupName, workspaceCollectionName, context); + } + + public WorkspaceCollectionAccessKeys regenerateKey(WorkspaceCollectionAccessKey body) { + return serviceManager.workspaceCollections().regenerateKey(resourceGroupName, workspaceCollectionName, body); + } + + public Response regenerateKeyWithResponse( + WorkspaceCollectionAccessKey body, Context context) { + return serviceManager + .workspaceCollections() + .regenerateKeyWithResponse(resourceGroupName, workspaceCollectionName, body, context); + } + + public WorkspaceCollectionImpl withRegion(Region location) { + this.createBody.withLocation(location.toString()); + return this; + } + + public WorkspaceCollectionImpl withRegion(String location) { + this.createBody.withLocation(location); + return this; + } + + public WorkspaceCollectionImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createBody.withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public WorkspaceCollectionImpl withSku(AzureSku sku) { + if (isInCreateMode()) { + this.createBody.withSku(sku); + return this; + } else { + this.updateBody.withSku(sku); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionsClientImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionsClientImpl.java new file mode 100644 index 0000000000000..ce6def9712b39 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionsClientImpl.java @@ -0,0 +1,1874 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.powerbiembedded.fluent.WorkspaceCollectionsClient; +import com.azure.resourcemanager.powerbiembedded.fluent.models.CheckNameResponseInner; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionAccessKeysInner; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameRequest; +import com.azure.resourcemanager.powerbiembedded.models.CreateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.MigrateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.UpdateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKey; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionList; +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 WorkspaceCollectionsClient. */ +public final class WorkspaceCollectionsClientImpl implements WorkspaceCollectionsClient { + private final ClientLogger logger = new ClientLogger(WorkspaceCollectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkspaceCollectionsService service; + + /** The service client containing this operation class. */ + private final PowerBIEmbeddedManagementClientImpl client; + + /** + * Initializes an instance of WorkspaceCollectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspaceCollectionsClientImpl(PowerBIEmbeddedManagementClientImpl client) { + this.service = + RestProxy + .create(WorkspaceCollectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerBIEmbeddedManagementClientWorkspaceCollections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerBIEmbeddedManag") + private interface WorkspaceCollectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CreateWorkspaceCollectionRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") UpdateWorkspaceCollectionRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/locations/{location}/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") CheckNameRequest body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/workspaceCollections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}/listKeys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getAccessKeys( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}/regenerateKey") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> regenerateKey( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") WorkspaceCollectionAccessKey body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> migrate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MigrateWorkspaceCollectionRequest body, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceCollectionName) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String workspaceCollectionName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceCollectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceCollectionInner getByResourceGroup(String resourceGroupName, String workspaceCollectionName) { + return getByResourceGroupAsync(resourceGroupName, workspaceCollectionName).block(); + } + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceCollectionName, context).block(); + } + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, CreateWorkspaceCollectionRequest body) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String workspaceCollectionName, + CreateWorkspaceCollectionRequest body, + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String workspaceCollectionName, CreateWorkspaceCollectionRequest body) { + return createWithResponseAsync(resourceGroupName, workspaceCollectionName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceCollectionInner create( + String resourceGroupName, String workspaceCollectionName, CreateWorkspaceCollectionRequest body) { + return createAsync(resourceGroupName, workspaceCollectionName, body).block(); + } + + /** + * Creates a new Power BI Workspace Collection with the specified properties. A Power BI Workspace Collection + * contains one or more workspaces, and can be used to provision keys that provide API access to those workspaces. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Create workspace collection request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String workspaceCollectionName, + CreateWorkspaceCollectionRequest body, + Context context) { + return createWithResponseAsync(resourceGroupName, workspaceCollectionName, body, context).block(); + } + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, UpdateWorkspaceCollectionRequest body) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String workspaceCollectionName, + UpdateWorkspaceCollectionRequest body, + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String workspaceCollectionName, UpdateWorkspaceCollectionRequest body) { + return updateWithResponseAsync(resourceGroupName, workspaceCollectionName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceCollectionInner update( + String resourceGroupName, String workspaceCollectionName, UpdateWorkspaceCollectionRequest body) { + return updateAsync(resourceGroupName, workspaceCollectionName, body).block(); + } + + /** + * Update an existing Power BI Workspace Collection with the specified properties. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Update workspace collection request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String workspaceCollectionName, + UpdateWorkspaceCollectionRequest body, + Context context) { + return updateWithResponseAsync(resourceGroupName, workspaceCollectionName, body, context).block(); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String workspaceCollectionName) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceCollectionName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceCollectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String workspaceCollectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, workspaceCollectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceCollectionName) { + return beginDeleteAsync(resourceGroupName, workspaceCollectionName).getSyncPoller(); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String workspaceCollectionName, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceCollectionName, context).getSyncPoller(); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceCollectionName) { + return beginDeleteAsync(resourceGroupName, workspaceCollectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String workspaceCollectionName, Context context) { + return beginDeleteAsync(resourceGroupName, workspaceCollectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceCollectionName) { + deleteAsync(resourceGroupName, workspaceCollectionName).block(); + } + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceCollectionName, Context context) { + deleteAsync(resourceGroupName, workspaceCollectionName, context).block(); + } + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String location, CheckNameRequest body) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkNameAvailabilityWithResponseAsync( + String location, CheckNameRequest body, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkNameAvailabilityAsync(String location, CheckNameRequest body) { + return checkNameAvailabilityWithResponseAsync(location, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameResponseInner checkNameAvailability(String location, CheckNameRequest body) { + return checkNameAvailabilityAsync(location, body).block(); + } + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkNameAvailabilityWithResponse( + String location, CheckNameRequest body, Context context) { + return checkNameAvailabilityWithResponseAsync(location, body, context).block(); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> 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.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @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.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAccessKeysWithResponseAsync( + String resourceGroupName, String workspaceCollectionName) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getAccessKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getAccessKeysWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getAccessKeys( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAccessKeysAsync( + String resourceGroupName, String workspaceCollectionName) { + return getAccessKeysWithResponseAsync(resourceGroupName, workspaceCollectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceCollectionAccessKeysInner getAccessKeys(String resourceGroupName, String workspaceCollectionName) { + return getAccessKeysAsync(resourceGroupName, workspaceCollectionName).block(); + } + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getAccessKeysWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context) { + return getAccessKeysWithResponseAsync(resourceGroupName, workspaceCollectionName, context).block(); + } + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> regenerateKeyWithResponseAsync( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body, 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .regenerateKey( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono regenerateKeyAsync( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body) { + return regenerateKeyWithResponseAsync(resourceGroupName, workspaceCollectionName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceCollectionAccessKeysInner regenerateKey( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body) { + return regenerateKeyAsync(resourceGroupName, workspaceCollectionName, body).block(); + } + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response regenerateKeyWithResponse( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body, Context context) { + return regenerateKeyWithResponseAsync(resourceGroupName, workspaceCollectionName, body, context).block(); + } + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> migrateWithResponseAsync( + String resourceGroupName, MigrateWorkspaceCollectionRequest body) { + 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 (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .migrate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> migrateWithResponseAsync( + String resourceGroupName, MigrateWorkspaceCollectionRequest body, 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 (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .migrate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + this.client.getApiVersion(), + body, + accept, + context); + } + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono migrateAsync(String resourceGroupName, MigrateWorkspaceCollectionRequest body) { + return migrateWithResponseAsync(resourceGroupName, body).flatMap((Response res) -> Mono.empty()); + } + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void migrate(String resourceGroupName, MigrateWorkspaceCollectionRequest body) { + migrateAsync(resourceGroupName, body).block(); + } + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response migrateWithResponse( + String resourceGroupName, MigrateWorkspaceCollectionRequest body, Context context) { + return migrateWithResponseAsync(resourceGroupName, body, context).block(); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionsImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionsImpl.java new file mode 100644 index 0000000000000..911c1c5b4adee --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceCollectionsImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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.powerbiembedded.fluent.WorkspaceCollectionsClient; +import com.azure.resourcemanager.powerbiembedded.fluent.models.CheckNameResponseInner; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionAccessKeysInner; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameRequest; +import com.azure.resourcemanager.powerbiembedded.models.CheckNameResponse; +import com.azure.resourcemanager.powerbiembedded.models.MigrateWorkspaceCollectionRequest; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollection; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKey; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollectionAccessKeys; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceCollections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkspaceCollectionsImpl implements WorkspaceCollections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceCollectionsImpl.class); + + private final WorkspaceCollectionsClient innerClient; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + public WorkspaceCollectionsImpl( + WorkspaceCollectionsClient innerClient, + com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public WorkspaceCollection getByResourceGroup(String resourceGroupName, String workspaceCollectionName) { + WorkspaceCollectionInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, workspaceCollectionName); + if (inner != null) { + return new WorkspaceCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, workspaceCollectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String workspaceCollectionName) { + this.serviceClient().delete(resourceGroupName, workspaceCollectionName); + } + + public void delete(String resourceGroupName, String workspaceCollectionName, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceCollectionName, context); + } + + public CheckNameResponse checkNameAvailability(String location, CheckNameRequest body) { + CheckNameResponseInner inner = this.serviceClient().checkNameAvailability(location, body); + if (inner != null) { + return new CheckNameResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkNameAvailabilityWithResponse( + String location, CheckNameRequest body, Context context) { + Response inner = + this.serviceClient().checkNameAvailabilityWithResponse(location, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new WorkspaceCollectionImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new WorkspaceCollectionImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new WorkspaceCollectionImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new WorkspaceCollectionImpl(inner1, this.manager())); + } + + public WorkspaceCollectionAccessKeys getAccessKeys(String resourceGroupName, String workspaceCollectionName) { + WorkspaceCollectionAccessKeysInner inner = + this.serviceClient().getAccessKeys(resourceGroupName, workspaceCollectionName); + if (inner != null) { + return new WorkspaceCollectionAccessKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getAccessKeysWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context) { + Response inner = + this.serviceClient().getAccessKeysWithResponse(resourceGroupName, workspaceCollectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceCollectionAccessKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public WorkspaceCollectionAccessKeys regenerateKey( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body) { + WorkspaceCollectionAccessKeysInner inner = + this.serviceClient().regenerateKey(resourceGroupName, workspaceCollectionName, body); + if (inner != null) { + return new WorkspaceCollectionAccessKeysImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response regenerateKeyWithResponse( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body, Context context) { + Response inner = + this.serviceClient().regenerateKeyWithResponse(resourceGroupName, workspaceCollectionName, body, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WorkspaceCollectionAccessKeysImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void migrate(String resourceGroupName, MigrateWorkspaceCollectionRequest body) { + this.serviceClient().migrate(resourceGroupName, body); + } + + public Response migrateWithResponse( + String resourceGroupName, MigrateWorkspaceCollectionRequest body, Context context) { + return this.serviceClient().migrateWithResponse(resourceGroupName, body, context); + } + + public WorkspaceCollection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceCollectionName = Utils.getValueFromIdByName(id, "workspaceCollections"); + if (workspaceCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceCollections'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceCollectionName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceCollectionName = Utils.getValueFromIdByName(id, "workspaceCollections"); + if (workspaceCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceCollections'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceCollectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceCollectionName = Utils.getValueFromIdByName(id, "workspaceCollections"); + if (workspaceCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceCollections'.", + id))); + } + this.delete(resourceGroupName, workspaceCollectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceCollectionName = Utils.getValueFromIdByName(id, "workspaceCollections"); + if (workspaceCollectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'workspaceCollections'.", + id))); + } + this.delete(resourceGroupName, workspaceCollectionName, context); + } + + private WorkspaceCollectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } + + public WorkspaceCollectionImpl define(String name) { + return new WorkspaceCollectionImpl(name, this.manager()); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceImpl.java new file mode 100644 index 0000000000000..007f4166aff24 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspaceImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.implementation; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.powerbiembedded.models.Workspace; + +public final class WorkspaceImpl implements Workspace { + private WorkspaceInner innerObject; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + WorkspaceImpl( + WorkspaceInner innerObject, com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public WorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspacesClientImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspacesClientImpl.java new file mode 100644 index 0000000000000..83dff862be074 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspacesClientImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.fluent.WorkspacesClient; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.powerbiembedded.models.WorkspaceList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WorkspacesClient. */ +public final class WorkspacesClientImpl implements WorkspacesClient { + private final ClientLogger logger = new ClientLogger(WorkspacesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WorkspacesService service; + + /** The service client containing this operation class. */ + private final PowerBIEmbeddedManagementClientImpl client; + + /** + * Initializes an instance of WorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacesClientImpl(PowerBIEmbeddedManagementClientImpl client) { + this.service = + RestProxy.create(WorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PowerBIEmbeddedManagementClientWorkspaces to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PowerBIEmbeddedManag") + private interface WorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI" + + "/workspaceCollections/{workspaceCollectionName}/workspaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("workspaceCollectionName") String workspaceCollectionName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String workspaceCollectionName) { + 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String workspaceCollectionName, 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 (workspaceCollectionName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter workspaceCollectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + workspaceCollectionName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String workspaceCollectionName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceCollectionName)); + } + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String workspaceCollectionName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, workspaceCollectionName, context)); + } + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String workspaceCollectionName) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceCollectionName)); + } + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String workspaceCollectionName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, workspaceCollectionName, context)); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspacesImpl.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspacesImpl.java new file mode 100644 index 0000000000000..a911fb11b151c --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/WorkspacesImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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.powerbiembedded.fluent.WorkspacesClient; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.powerbiembedded.models.Workspace; +import com.azure.resourcemanager.powerbiembedded.models.Workspaces; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WorkspacesImpl implements Workspaces { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspacesImpl.class); + + private final WorkspacesClient innerClient; + + private final com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager; + + public WorkspacesImpl( + WorkspacesClient innerClient, com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String workspaceCollectionName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, workspaceCollectionName); + return Utils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String workspaceCollectionName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, workspaceCollectionName, context); + return Utils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + private WorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.powerbiembedded.PowerBIEmbeddedManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/package-info.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/package-info.java new file mode 100644 index 0000000000000..b07d153ce9b91 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for PowerBIEmbeddedManagementClient. Client to manage your Power BI Embedded + * workspace collections and retrieve workspaces. + */ +package com.azure.resourcemanager.powerbiembedded.implementation; diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AccessKeyName.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AccessKeyName.java new file mode 100644 index 0000000000000..04eac57ffaacc --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AccessKeyName.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AccessKeyName. */ +public enum AccessKeyName { + /** Enum value key1. */ + KEY1("key1"), + + /** Enum value key2. */ + KEY2("key2"); + + /** The actual serialized value for a AccessKeyName instance. */ + private final String value; + + AccessKeyName(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AccessKeyName instance. + * + * @param value the serialized value to parse. + * @return the parsed AccessKeyName object, or null if unable to parse. + */ + @JsonCreator + public static AccessKeyName fromString(String value) { + AccessKeyName[] items = AccessKeyName.values(); + for (AccessKeyName item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSku.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSku.java new file mode 100644 index 0000000000000..e858df56e0d3f --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSku.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The AzureSku model. */ +@Fluent +public final class AzureSku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureSku.class); + + /* + * SKU name + */ + @JsonProperty(value = "name", required = true) + private AzureSkuName name; + + /* + * SKU tier + */ + @JsonProperty(value = "tier", required = true) + private AzureSkuTier tier; + + /** + * Get the name property: SKU name. + * + * @return the name value. + */ + public AzureSkuName name() { + return this.name; + } + + /** + * Set the name property: SKU name. + * + * @param name the name value to set. + * @return the AzureSku object itself. + */ + public AzureSku withName(AzureSkuName name) { + this.name = name; + return this; + } + + /** + * Get the tier property: SKU tier. + * + * @return the tier value. + */ + public AzureSkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: SKU tier. + * + * @param tier the tier value to set. + * @return the AzureSku object itself. + */ + public AzureSku withTier(AzureSkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model AzureSku")); + } + if (tier() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property tier in model AzureSku")); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSkuName.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSkuName.java new file mode 100644 index 0000000000000..1a85e0f3b2b7b --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSkuName.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AzureSkuName. */ +public final class AzureSkuName extends ExpandableStringEnum { + /** Static value S1 for AzureSkuName. */ + public static final AzureSkuName S1 = fromString("S1"); + + /** + * Creates or finds a AzureSkuName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureSkuName. + */ + @JsonCreator + public static AzureSkuName fromString(String name) { + return fromString(name, AzureSkuName.class); + } + + /** @return known AzureSkuName values. */ + public static Collection values() { + return values(AzureSkuName.class); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSkuTier.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSkuTier.java new file mode 100644 index 0000000000000..097158b747622 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/AzureSkuTier.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AzureSkuTier. */ +public final class AzureSkuTier extends ExpandableStringEnum { + /** Static value Standard for AzureSkuTier. */ + public static final AzureSkuTier STANDARD = fromString("Standard"); + + /** + * Creates or finds a AzureSkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureSkuTier. + */ + @JsonCreator + public static AzureSkuTier fromString(String name) { + return fromString(name, AzureSkuTier.class); + } + + /** @return known AzureSkuTier values. */ + public static Collection values() { + return values(AzureSkuTier.class); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameReason.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameReason.java new file mode 100644 index 0000000000000..239b3638a73d0 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameReason.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CheckNameReason. */ +public final class CheckNameReason extends ExpandableStringEnum { + /** Static value Unavailable for CheckNameReason. */ + public static final CheckNameReason UNAVAILABLE = fromString("Unavailable"); + + /** Static value Invalid for CheckNameReason. */ + public static final CheckNameReason INVALID = fromString("Invalid"); + + /** + * Creates or finds a CheckNameReason from its string representation. + * + * @param name a name to look for. + * @return the corresponding CheckNameReason. + */ + @JsonCreator + public static CheckNameReason fromString(String name) { + return fromString(name, CheckNameReason.class); + } + + /** @return known CheckNameReason values. */ + public static Collection values() { + return values(CheckNameReason.class); + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameRequest.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameRequest.java new file mode 100644 index 0000000000000..c80ad409e2e7e --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameRequest.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The CheckNameRequest model. */ +@Fluent +public final class CheckNameRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameRequest.class); + + /* + * Workspace collection name + */ + @JsonProperty(value = "name") + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: Workspace collection name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Workspace collection name. + * + * @param name the name value to set. + * @return the CheckNameRequest object itself. + */ + public CheckNameRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Resource type. + * + * @param type the type value to set. + * @return the CheckNameRequest object itself. + */ + public CheckNameRequest withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameResponse.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameResponse.java new file mode 100644 index 0000000000000..1f1cf35f328a7 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CheckNameResponse.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.CheckNameResponseInner; + +/** An immutable client-side representation of CheckNameResponse. */ +public interface CheckNameResponse { + /** + * Gets the nameAvailable property: Specifies a Boolean value that indicates whether the specified Power BI + * Workspace Collection name is available to use. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Reason why the workspace collection name cannot be used. + * + * @return the reason value. + */ + CheckNameReason reason(); + + /** + * Gets the message property: Message indicating an unavailable name due to a conflict, or a description of the + * naming rules that are violated. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.powerbiembedded.fluent.models.CheckNameResponseInner object. + * + * @return the inner object. + */ + CheckNameResponseInner innerModel(); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CreateWorkspaceCollectionRequest.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CreateWorkspaceCollectionRequest.java new file mode 100644 index 0000000000000..f694366e77a9d --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/CreateWorkspaceCollectionRequest.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The CreateWorkspaceCollectionRequest model. */ +@Fluent +public final class CreateWorkspaceCollectionRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CreateWorkspaceCollectionRequest.class); + + /* + * Azure location + */ + @JsonProperty(value = "location") + private String location; + + /* + * Dictionary of + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The sku property. + */ + @JsonProperty(value = "sku") + private AzureSku sku; + + /** + * Get the location property: Azure location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Azure location. + * + * @param location the location value to set. + * @return the CreateWorkspaceCollectionRequest object itself. + */ + public CreateWorkspaceCollectionRequest withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Dictionary of <string>. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of <string>. + * + * @param tags the tags value to set. + * @return the CreateWorkspaceCollectionRequest object itself. + */ + public CreateWorkspaceCollectionRequest withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: The sku property. + * + * @return the sku value. + */ + public AzureSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku property. + * + * @param sku the sku value to set. + * @return the CreateWorkspaceCollectionRequest object itself. + */ + public CreateWorkspaceCollectionRequest withSku(AzureSku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Display.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Display.java new file mode 100644 index 0000000000000..28805e53ad809 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Display.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Display model. */ +@Fluent +public final class Display { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Display.class); + + /* + * The localized friendly form of the resource provider name. This form is + * also expected to include the publisher/company responsible. Use Title + * Casing. Begin with "Microsoft" for 1st party services. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * The localized friendly form of the resource type related to this + * action/operation. This form should match the public documentation for + * the resource provider. Use Title Casing. For examples, refer to the + * "name" section. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The localized friendly name for the operation as shown to the user. This + * name should be concise (to fit in drop downs), but clear + * (self-documenting). Use Title Casing and include the entity/resource to + * which it applies. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The localized friendly description for the operation as shown to the + * user. This description should be thorough, yet concise. It will be used + * in tool-tips and detailed views. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The intended executor of the operation; governs the display of the + * operation in the RBAC UX and the audit logs UX. Default value is + * 'user,system' + */ + @JsonProperty(value = "origin") + private String origin; + + /** + * Get the provider property: The localized friendly form of the resource provider name. This form is also expected + * to include the publisher/company responsible. Use Title Casing. Begin with "Microsoft" for 1st party services. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: The localized friendly form of the resource provider name. This form is also expected + * to include the publisher/company responsible. Use Title Casing. Begin with "Microsoft" for 1st party services. + * + * @param provider the provider value to set. + * @return the Display object itself. + */ + public Display withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: The localized friendly form of the resource type related to this action/operation. + * This form should match the public documentation for the resource provider. Use Title Casing. For examples, refer + * to the "name" section. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The localized friendly form of the resource type related to this action/operation. + * This form should match the public documentation for the resource provider. Use Title Casing. For examples, refer + * to the "name" section. + * + * @param resource the resource value to set. + * @return the Display object itself. + */ + public Display withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: The localized friendly name for the operation as shown to the user. This name should + * be concise (to fit in drop downs), but clear (self-documenting). Use Title Casing and include the entity/resource + * to which it applies. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: The localized friendly name for the operation as shown to the user. This name should + * be concise (to fit in drop downs), but clear (self-documenting). Use Title Casing and include the entity/resource + * to which it applies. + * + * @param operation the operation value to set. + * @return the Display object itself. + */ + public Display withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: The localized friendly description for the operation as shown to the user. This + * description should be thorough, yet concise. It will be used in tool-tips and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The localized friendly description for the operation as shown to the user. This + * description should be thorough, yet concise. It will be used in tool-tips and detailed views. + * + * @param description the description value to set. + * @return the Display object itself. + */ + public Display withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; governs the display of the operation in the RBAC + * UX and the audit logs UX. Default value is 'user,system'. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The intended executor of the operation; governs the display of the operation in the RBAC + * UX and the audit logs UX. Default value is 'user,system'. + * + * @param origin the origin value to set. + * @return the Display object itself. + */ + public Display withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/MigrateWorkspaceCollectionRequest.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/MigrateWorkspaceCollectionRequest.java new file mode 100644 index 0000000000000..786f3d4f36a2e --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/MigrateWorkspaceCollectionRequest.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The MigrateWorkspaceCollectionRequest model. */ +@Fluent +public final class MigrateWorkspaceCollectionRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MigrateWorkspaceCollectionRequest.class); + + /* + * Name of the resource group the Power BI workspace collections will be + * migrated to. + */ + @JsonProperty(value = "targetResourceGroup") + private String targetResourceGroup; + + /* + * The resources property. + */ + @JsonProperty(value = "resources") + private List resources; + + /** + * Get the targetResourceGroup property: Name of the resource group the Power BI workspace collections will be + * migrated to. + * + * @return the targetResourceGroup value. + */ + public String targetResourceGroup() { + return this.targetResourceGroup; + } + + /** + * Set the targetResourceGroup property: Name of the resource group the Power BI workspace collections will be + * migrated to. + * + * @param targetResourceGroup the targetResourceGroup value to set. + * @return the MigrateWorkspaceCollectionRequest object itself. + */ + public MigrateWorkspaceCollectionRequest withTargetResourceGroup(String targetResourceGroup) { + this.targetResourceGroup = targetResourceGroup; + return this; + } + + /** + * Get the resources property: The resources property. + * + * @return the resources value. + */ + public List resources() { + return this.resources; + } + + /** + * Set the resources property: The resources property. + * + * @param resources the resources value to set. + * @return the MigrateWorkspaceCollectionRequest object itself. + */ + public MigrateWorkspaceCollectionRequest withResources(List resources) { + this.resources = resources; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Operation.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Operation.java new file mode 100644 index 0000000000000..4ef179ef7f868 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Operation.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Operation model. */ +@Fluent +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * The name of the operation being performed on this particular object. + * This name should match the action name that appears in RBAC / the event + * service. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The display property. + */ + @JsonProperty(value = "display") + private Display display; + + /** + * Get the name property: The name of the operation being performed on this particular object. This name should + * match the action name that appears in RBAC / the event service. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the operation being performed on this particular object. This name should + * match the action name that appears in RBAC / the event service. + * + * @param name the name value to set. + * @return the Operation object itself. + */ + public Operation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The display property. + * + * @return the display value. + */ + public Display display() { + return this.display; + } + + /** + * Set the display property: The display property. + * + * @param display the display value to set. + * @return the Operation object itself. + */ + public Operation withDisplay(Display display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/OperationList.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/OperationList.java new file mode 100644 index 0000000000000..40c3a1acf5d74 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/OperationList.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.OperationListInner; +import java.util.List; + +/** An immutable client-side representation of OperationList. */ +public interface OperationList { + /** + * Gets the value property: The value property. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.powerbiembedded.fluent.models.OperationListInner object. + * + * @return the inner object. + */ + OperationListInner innerModel(); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/ResourceProviders.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/ResourceProviders.java new file mode 100644 index 0000000000000..65a6d86e89b35 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/ResourceProviders.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + OperationList getAvailableOperations(); + + /** + * Indicates which operations can be performed by the Power BI Resource 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 the response. + */ + Response getAvailableOperationsWithResponse(Context context); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/UpdateWorkspaceCollectionRequest.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/UpdateWorkspaceCollectionRequest.java new file mode 100644 index 0000000000000..50704d4abfdcd --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/UpdateWorkspaceCollectionRequest.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The UpdateWorkspaceCollectionRequest model. */ +@Fluent +public final class UpdateWorkspaceCollectionRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UpdateWorkspaceCollectionRequest.class); + + /* + * Dictionary of + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The sku property. + */ + @JsonProperty(value = "sku") + private AzureSku sku; + + /** + * Get the tags property: Dictionary of <string>. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Dictionary of <string>. + * + * @param tags the tags value to set. + * @return the UpdateWorkspaceCollectionRequest object itself. + */ + public UpdateWorkspaceCollectionRequest withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: The sku property. + * + * @return the sku value. + */ + public AzureSku sku() { + return this.sku; + } + + /** + * Set the sku property: The sku property. + * + * @param sku the sku value to set. + * @return the UpdateWorkspaceCollectionRequest object itself. + */ + public UpdateWorkspaceCollectionRequest withSku(AzureSku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Workspace.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Workspace.java new file mode 100644 index 0000000000000..416e1b54ee85a --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Workspace.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceInner; + +/** An immutable client-side representation of Workspace. */ +public interface Workspace { + /** + * Gets the id property: Workspace id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Workspace name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: Property bag. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceInner object. + * + * @return the inner object. + */ + WorkspaceInner innerModel(); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollection.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollection.java new file mode 100644 index 0000000000000..a7042185dd84f --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollection.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner; +import java.util.Map; + +/** An immutable client-side representation of WorkspaceCollection. */ +public interface WorkspaceCollection { + /** + * Gets the id property: Resource id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Workspace collection name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: Azure location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Dictionary of <string>. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The sku property. + * + * @return the sku value. + */ + AzureSku sku(); + + /** + * Gets the properties property: Properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner object. + * + * @return the inner object. + */ + WorkspaceCollectionInner innerModel(); + + /** The entirety of the WorkspaceCollection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + /** The WorkspaceCollection definition stages. */ + interface DefinitionStages { + /** The first stage of the WorkspaceCollection definition. */ + interface Blank extends WithResourceGroup { + } + /** The stage of the WorkspaceCollection definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName Azure resource group. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the WorkspaceCollection definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithLocation, DefinitionStages.WithTags, DefinitionStages.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspaceCollection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspaceCollection create(Context context); + } + /** The stage of the WorkspaceCollection definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location Azure location. + * @return the next definition stage. + */ + WithCreate withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location Azure location. + * @return the next definition stage. + */ + WithCreate withRegion(String location); + } + /** The stage of the WorkspaceCollection definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Dictionary of <string>. + * + * @param tags Dictionary of <string>. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the WorkspaceCollection definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The sku property.. + * + * @param sku The sku property. + * @return the next definition stage. + */ + WithCreate withSku(AzureSku sku); + } + } + /** + * Begins update for the WorkspaceCollection resource. + * + * @return the stage of resource update. + */ + WorkspaceCollection.Update update(); + + /** The template for WorkspaceCollection update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspaceCollection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspaceCollection apply(Context context); + } + /** The WorkspaceCollection update stages. */ + interface UpdateStages { + /** The stage of the WorkspaceCollection update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Dictionary of <string>. + * + * @param tags Dictionary of <string>. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the WorkspaceCollection update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The sku property.. + * + * @param sku The sku property. + * @return the next definition stage. + */ + Update withSku(AzureSku sku); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspaceCollection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspaceCollection refresh(Context context); + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + WorkspaceCollectionAccessKeys getAccessKeys(); + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getAccessKeysWithResponse(Context context); + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param body Access key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + WorkspaceCollectionAccessKeys regenerateKey(WorkspaceCollectionAccessKey body); + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param body Access key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response regenerateKeyWithResponse( + WorkspaceCollectionAccessKey body, Context context); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionAccessKey.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionAccessKey.java new file mode 100644 index 0000000000000..c387255635b4c --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionAccessKey.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The WorkspaceCollectionAccessKey model. */ +@Fluent +public final class WorkspaceCollectionAccessKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceCollectionAccessKey.class); + + /* + * Key name + */ + @JsonProperty(value = "keyName") + private AccessKeyName keyName; + + /** + * Get the keyName property: Key name. + * + * @return the keyName value. + */ + public AccessKeyName keyName() { + return this.keyName; + } + + /** + * Set the keyName property: Key name. + * + * @param keyName the keyName value to set. + * @return the WorkspaceCollectionAccessKey object itself. + */ + public WorkspaceCollectionAccessKey withKeyName(AccessKeyName keyName) { + this.keyName = keyName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionAccessKeys.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionAccessKeys.java new file mode 100644 index 0000000000000..439215ffa6209 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionAccessKeys.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionAccessKeysInner; + +/** An immutable client-side representation of WorkspaceCollectionAccessKeys. */ +public interface WorkspaceCollectionAccessKeys { + /** + * Gets the key1 property: Access key 1. + * + * @return the key1 value. + */ + String key1(); + + /** + * Gets the key2 property: Access key 2. + * + * @return the key2 value. + */ + String key2(); + + /** + * Gets the inner com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionAccessKeysInner object. + * + * @return the inner object. + */ + WorkspaceCollectionAccessKeysInner innerModel(); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionList.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionList.java new file mode 100644 index 0000000000000..50ce7bbb047b5 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollectionList.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceCollectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The WorkspaceCollectionList model. */ +@Fluent +public final class WorkspaceCollectionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceCollectionList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the WorkspaceCollectionList object itself. + */ + public WorkspaceCollectionList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollections.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollections.java new file mode 100644 index 0000000000000..a36210a9e1510 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceCollections.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.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 WorkspaceCollections. */ +public interface WorkspaceCollections { + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + WorkspaceCollection getByResourceGroup(String resourceGroupName, String workspaceCollectionName); + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String workspaceCollectionName); + + /** + * Delete a Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + CheckNameResponse checkNameAvailability(String location, CheckNameRequest body); + + /** + * Verify the specified Power BI Workspace Collection name is valid and not already in use. + * + * @param location Azure location. + * @param body Check name availability request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response checkNameAvailabilityWithResponse( + String location, CheckNameRequest body, Context context); + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieves all existing Power BI workspace collections in the specified resource group. + * + * @param resourceGroupName Azure resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(); + + /** + * Retrieves all existing Power BI workspace collections in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(Context context); + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + WorkspaceCollectionAccessKeys getAccessKeys(String resourceGroupName, String workspaceCollectionName); + + /** + * Retrieves the primary and secondary access keys for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getAccessKeysWithResponse( + String resourceGroupName, String workspaceCollectionName, Context context); + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + */ + WorkspaceCollectionAccessKeys regenerateKey( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body); + + /** + * Regenerates the primary or secondary access key for the specified Power BI Workspace Collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param body Access key to regenerate. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response regenerateKeyWithResponse( + String resourceGroupName, String workspaceCollectionName, WorkspaceCollectionAccessKey body, Context context); + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void migrate(String resourceGroupName, MigrateWorkspaceCollectionRequest body); + + /** + * Migrates an existing Power BI Workspace Collection to a different resource group and/or subscription. + * + * @param resourceGroupName Azure resource group. + * @param body Workspace migration request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response migrateWithResponse( + String resourceGroupName, MigrateWorkspaceCollectionRequest body, Context context); + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + WorkspaceCollection getById(String id); + + /** + * Retrieves an existing Power BI Workspace Collection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Power BI Workspace Collection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Power BI Workspace Collection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspaceCollection resource. + * + * @param name resource name. + * @return the first stage of the new WorkspaceCollection definition. + */ + WorkspaceCollection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceList.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceList.java new file mode 100644 index 0000000000000..9f60d9611f1d4 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/WorkspaceList.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.powerbiembedded.fluent.models.WorkspaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The WorkspaceList model. */ +@Fluent +public final class WorkspaceList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceList.class); + + /* + * The value property. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The value property. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The value property. + * + * @param value the value value to set. + * @return the WorkspaceList object itself. + */ + public WorkspaceList withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Workspaces.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Workspaces.java new file mode 100644 index 0000000000000..f103a7e802eab --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/Workspaces.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.powerbiembedded.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Workspaces. */ +public interface Workspaces { + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(String resourceGroupName, String workspaceCollectionName); + + /** + * Retrieves all existing Power BI workspaces in the specified workspace collection. + * + * @param resourceGroupName Azure resource group. + * @param workspaceCollectionName Power BI Embedded Workspace Collection name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + PagedIterable list(String resourceGroupName, String workspaceCollectionName, Context context); +} diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/package-info.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/package-info.java new file mode 100644 index 0000000000000..9e2c9ba08f01d --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for PowerBIEmbeddedManagementClient. Client to manage your Power BI Embedded + * workspace collections and retrieve workspaces. + */ +package com.azure.resourcemanager.powerbiembedded.models; diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/package-info.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/package-info.java new file mode 100644 index 0000000000000..dad295e288790 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/com/azure/resourcemanager/powerbiembedded/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for PowerBIEmbeddedManagementClient. Client to manage your Power BI Embedded workspace + * collections and retrieve workspaces. + */ +package com.azure.resourcemanager.powerbiembedded; diff --git a/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/module-info.java b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/module-info.java new file mode 100644 index 0000000000000..7f296a0710408 --- /dev/null +++ b/sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.powerbiembedded { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.powerbiembedded; + exports com.azure.resourcemanager.powerbiembedded.fluent; + exports com.azure.resourcemanager.powerbiembedded.fluent.models; + exports com.azure.resourcemanager.powerbiembedded.models; + + opens com.azure.resourcemanager.powerbiembedded.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.powerbiembedded.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/powerbiembedded/ci.yml b/sdk/powerbiembedded/ci.yml new file mode 100644 index 0000000000000..2de2e150186ea --- /dev/null +++ b/sdk/powerbiembedded/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/powerbiembedded/ci.yml + - sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/ + exclude: + - sdk/powerbiembedded/pom.xml + - sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/powerbiembedded/ci.yml + - sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/ + exclude: + - sdk/powerbiembedded/pom.xml + - sdk/powerbiembedded/azure-resourcemanager-powerbiembedded/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: powerbiembedded + Artifacts: + - name: azure-resourcemanager-powerbiembedded + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerpowerbiembedded diff --git a/sdk/powerbiembedded/pom.xml b/sdk/powerbiembedded/pom.xml new file mode 100644 index 0000000000000..450cc64a04daa --- /dev/null +++ b/sdk/powerbiembedded/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-powerbiembedded-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-powerbiembedded + + + +