diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index eda21ff823754..ff59434c5449c 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -187,6 +187,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-attestation;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b80dac967d8f2..22bb9b8e0ac46 100644 --- a/pom.xml +++ b/pom.xml @@ -13,6 +13,7 @@ eng/jacoco-test-coverage sdk/anomalydetector sdk/appconfiguration + sdk/attestation sdk/authorization sdk/batch sdk/boms diff --git a/sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md b/sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md new file mode 100644 index 0000000000000..41af17d6ab57a --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-04) + +- Azure Resource Manager Attestation client library for Java. This package contains Microsoft Azure SDK for Attestation Management SDK. Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. Package tag package-2018-09-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/attestation/azure-resourcemanager-attestation/README.md b/sdk/attestation/azure-resourcemanager-attestation/README.md new file mode 100644 index 0000000000000..2fb00c431bf53 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager Attestation client library for Java + +Azure Resource Manager Attestation client library for Java. + +This package contains Microsoft Azure SDK for Attestation Management SDK. Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. Package tag package-2018-09-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## 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-attestation;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-attestation + 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(); +AttestationManager manager = AttestationManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/attestation/azure-resourcemanager-attestation/pom.xml b/sdk/attestation/azure-resourcemanager-attestation/pom.xml new file mode 100644 index 0000000000000..0c3956e2682e6 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-attestation + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Attestation Management + This package contains Microsoft Azure SDK for Attestation Management SDK. Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. Package tag package-2018-09-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/AttestationManager.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/AttestationManager.java new file mode 100644 index 0000000000000..937753a52b3aa --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/AttestationManager.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.fluent.AttestationManagementClient; +import com.azure.resourcemanager.attestation.implementation.AttestationManagementClientBuilder; +import com.azure.resourcemanager.attestation.implementation.AttestationProvidersImpl; +import com.azure.resourcemanager.attestation.implementation.OperationsImpl; +import com.azure.resourcemanager.attestation.models.AttestationProviders; +import com.azure.resourcemanager.attestation.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to AttestationManager. Various APIs for managing resources in attestation service. This primarily + * encompasses per-tenant instance management. + */ +public final class AttestationManager { + private Operations operations; + + private AttestationProviders attestationProviders; + + private final AttestationManagementClient clientObject; + + private AttestationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new AttestationManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Attestation service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Attestation service API instance. + */ + public static AttestationManager 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 AttestationManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new AttestationManager.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 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; + } + + /** + * 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 Attestation service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Attestation service API instance. + */ + public AttestationManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.attestation", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new AttestationManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of AttestationProviders. */ + public AttestationProviders attestationProviders() { + if (this.attestationProviders == null) { + this.attestationProviders = new AttestationProvidersImpl(clientObject.getAttestationProviders(), this); + } + return attestationProviders; + } + + /** + * @return Wrapped service client AttestationManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public AttestationManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationManagementClient.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationManagementClient.java new file mode 100644 index 0000000000000..81c1fc6269d3f --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationManagementClient.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.attestation.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for AttestationManagementClient class. */ +public interface AttestationManagementClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AttestationProvidersClient object to access its operations. + * + * @return the AttestationProvidersClient object. + */ + AttestationProvidersClient getAttestationProviders(); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationProvidersClient.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationProvidersClient.java new file mode 100644 index 0000000000000..0d7b8f513e0ab --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationProvidersClient.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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.attestation.fluent.models.AttestationProviderInner; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner; +import com.azure.resourcemanager.attestation.models.AttestationServiceCreationParams; +import com.azure.resourcemanager.attestation.models.AttestationServicePatchParams; + +/** An instance of this class provides access to all the operations defined in AttestationProvidersClient. */ +public interface AttestationProvidersClient { + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @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 status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderInner getByResourceGroup(String resourceGroupName, String providerName); + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @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 status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String providerName, Context context); + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderInner create( + String resourceGroupName, String providerName, AttestationServiceCreationParams creationParams); + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String providerName, + AttestationServiceCreationParams creationParams, + Context context); + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderInner update( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams); + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams, Context context); + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @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 providerName); + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String providerName, Context context); + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderListResultInner list(); + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderListResultInner listByResourceGroup(String resourceGroupName); + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByResourceGroupWithResponse( + String resourceGroupName, Context context); + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderListResultInner listDefault(); + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listDefaultWithResponse(Context context); + + /** + * Get the default provider by location. + * + * @param location The location of the default provider. + * @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 default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AttestationProviderInner getDefaultByLocation(String location); + + /** + * Get the default provider by location. + * + * @param location The location of the default 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 default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getDefaultByLocationWithResponse(String location, Context context); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/OperationsClient.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/OperationsClient.java new file mode 100644 index 0000000000000..709f15ffb2f0d --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/OperationsClient.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.attestation.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.attestation.fluent.models.OperationListInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available Azure attestation operations. + * + * @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 list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListInner list(); + + /** + * Lists all of the available Azure attestation operations. + * + * @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 list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderInner.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderInner.java new file mode 100644 index 0000000000000..21351fcff0132 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderInner.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.models.AttestationServiceStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Attestation service response message. */ +@JsonFlatten +@Fluent +public class AttestationProviderInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationProviderInner.class); + + /* + * Trust model for the attestation service instance. + */ + @JsonProperty(value = "properties.trustModel") + private String trustModel; + + /* + * Status of attestation service. + */ + @JsonProperty(value = "properties.status") + private AttestationServiceStatus status; + + /* + * Gets the uri of attestation service + */ + @JsonProperty(value = "properties.attestUri") + private String attestUri; + + /** + * Get the trustModel property: Trust model for the attestation service instance. + * + * @return the trustModel value. + */ + public String trustModel() { + return this.trustModel; + } + + /** + * Set the trustModel property: Trust model for the attestation service instance. + * + * @param trustModel the trustModel value to set. + * @return the AttestationProviderInner object itself. + */ + public AttestationProviderInner withTrustModel(String trustModel) { + this.trustModel = trustModel; + return this; + } + + /** + * Get the status property: Status of attestation service. + * + * @return the status value. + */ + public AttestationServiceStatus status() { + return this.status; + } + + /** + * Set the status property: Status of attestation service. + * + * @param status the status value to set. + * @return the AttestationProviderInner object itself. + */ + public AttestationProviderInner withStatus(AttestationServiceStatus status) { + this.status = status; + return this; + } + + /** + * Get the attestUri property: Gets the uri of attestation service. + * + * @return the attestUri value. + */ + public String attestUri() { + return this.attestUri; + } + + /** + * Set the attestUri property: Gets the uri of attestation service. + * + * @param attestUri the attestUri value to set. + * @return the AttestationProviderInner object itself. + */ + public AttestationProviderInner withAttestUri(String attestUri) { + this.attestUri = attestUri; + return this; + } + + /** {@inheritDoc} */ + @Override + public AttestationProviderInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AttestationProviderInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderListResultInner.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderListResultInner.java new file mode 100644 index 0000000000000..8571e3222a3a5 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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; +import java.util.List; + +/** Attestation Providers List. */ +@Fluent +public final class AttestationProviderListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationProviderListResultInner.class); + + /* + * Attestation Provider array. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Attestation Provider array. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Attestation Provider array. + * + * @param value the value value to set. + * @return the AttestationProviderListResultInner object itself. + */ + public AttestationProviderListResultInner 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/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/OperationListInner.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/OperationListInner.java new file mode 100644 index 0000000000000..7182acd886eb7 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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.attestation.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.models.OperationsDefinition; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of supported operations. */ +@Fluent +public final class OperationListInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListInner.class); + + /* + * List of supported operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of supported operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of supported operations. + * + * @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/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/package-info.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/package-info.java new file mode 100644 index 0000000000000..4a3ef49de38b1 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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 AttestationManagementClient. Various APIs for managing resources in + * attestation service. This primarily encompasses per-tenant instance management. + */ +package com.azure.resourcemanager.attestation.fluent.models; diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/package-info.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/package-info.java new file mode 100644 index 0000000000000..571e94846ad69 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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 AttestationManagementClient. Various APIs for managing resources in + * attestation service. This primarily encompasses per-tenant instance management. + */ +package com.azure.resourcemanager.attestation.fluent; diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientBuilder.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientBuilder.java new file mode 100644 index 0000000000000..26932ca7a108e --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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 AttestationManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {AttestationManagementClientImpl.class}) +public final class AttestationManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the AttestationManagementClientBuilder. + */ + public AttestationManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the AttestationManagementClientBuilder. + */ + public AttestationManagementClientBuilder 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 AttestationManagementClientBuilder. + */ + public AttestationManagementClientBuilder 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 AttestationManagementClientBuilder. + */ + public AttestationManagementClientBuilder 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 AttestationManagementClientBuilder. + */ + public AttestationManagementClientBuilder 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 AttestationManagementClientBuilder. + */ + public AttestationManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of AttestationManagementClientImpl with the provided parameters. + * + * @return an instance of AttestationManagementClientImpl. + */ + public AttestationManagementClientImpl 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(); + } + AttestationManagementClientImpl client = + new AttestationManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientImpl.java new file mode 100644 index 0000000000000..ccae42fa41e9b --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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.attestation.fluent.AttestationManagementClient; +import com.azure.resourcemanager.attestation.fluent.AttestationProvidersClient; +import com.azure.resourcemanager.attestation.fluent.OperationsClient; +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 AttestationManagementClientImpl type. */ +@ServiceClient(builder = AttestationManagementClientBuilder.class) +public final class AttestationManagementClientImpl implements AttestationManagementClient { + private final ClientLogger logger = new ClientLogger(AttestationManagementClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AttestationProvidersClient object to access its operations. */ + private final AttestationProvidersClient attestationProviders; + + /** + * Gets the AttestationProvidersClient object to access its operations. + * + * @return the AttestationProvidersClient object. + */ + public AttestationProvidersClient getAttestationProviders() { + return this.attestationProviders; + } + + /** + * Initializes an instance of AttestationManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + AttestationManagementClientImpl( + 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 = "2018-09-01-preview"; + this.operations = new OperationsClientImpl(this); + this.attestationProviders = new AttestationProvidersClientImpl(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 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.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/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderImpl.java new file mode 100644 index 0000000000000..6104f7ee09577 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderImpl.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.attestation.AttestationManager; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import com.azure.resourcemanager.attestation.models.AttestationProvider; +import com.azure.resourcemanager.attestation.models.AttestationServiceCreationParams; +import com.azure.resourcemanager.attestation.models.AttestationServiceCreationSpecificParams; +import com.azure.resourcemanager.attestation.models.AttestationServicePatchParams; +import com.azure.resourcemanager.attestation.models.AttestationServiceStatus; +import java.util.Collections; +import java.util.Map; + +public final class AttestationProviderImpl + implements AttestationProvider, AttestationProvider.Definition, AttestationProvider.Update { + private AttestationProviderInner innerObject; + + private final AttestationManager 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 String trustModel() { + return this.innerModel().trustModel(); + } + + public AttestationServiceStatus status() { + return this.innerModel().status(); + } + + public String attestUri() { + return this.innerModel().attestUri(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AttestationProviderInner innerModel() { + return this.innerObject; + } + + private AttestationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String providerName; + + private AttestationServiceCreationParams createCreationParams; + + private AttestationServicePatchParams updateUpdateParams; + + public AttestationProviderImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AttestationProvider create() { + this.innerObject = + serviceManager + .serviceClient() + .getAttestationProviders() + .createWithResponse(resourceGroupName, providerName, createCreationParams, Context.NONE) + .getValue(); + return this; + } + + public AttestationProvider create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttestationProviders() + .createWithResponse(resourceGroupName, providerName, createCreationParams, context) + .getValue(); + return this; + } + + AttestationProviderImpl(String name, AttestationManager serviceManager) { + this.innerObject = new AttestationProviderInner(); + this.serviceManager = serviceManager; + this.providerName = name; + this.createCreationParams = new AttestationServiceCreationParams(); + } + + public AttestationProviderImpl update() { + this.updateUpdateParams = new AttestationServicePatchParams(); + return this; + } + + public AttestationProvider apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAttestationProviders() + .updateWithResponse(resourceGroupName, providerName, updateUpdateParams, Context.NONE) + .getValue(); + return this; + } + + public AttestationProvider apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttestationProviders() + .updateWithResponse(resourceGroupName, providerName, updateUpdateParams, context) + .getValue(); + return this; + } + + AttestationProviderImpl(AttestationProviderInner innerObject, AttestationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.providerName = Utils.getValueFromIdByName(innerObject.id(), "attestationProviders"); + } + + public AttestationProvider refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAttestationProviders() + .getByResourceGroupWithResponse(resourceGroupName, providerName, Context.NONE) + .getValue(); + return this; + } + + public AttestationProvider refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAttestationProviders() + .getByResourceGroupWithResponse(resourceGroupName, providerName, context) + .getValue(); + return this; + } + + public AttestationProviderImpl withRegion(Region location) { + this.createCreationParams.withLocation(location.toString()); + return this; + } + + public AttestationProviderImpl withRegion(String location) { + this.createCreationParams.withLocation(location); + return this; + } + + public AttestationProviderImpl withProperties(AttestationServiceCreationSpecificParams properties) { + this.createCreationParams.withProperties(properties); + return this; + } + + public AttestationProviderImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createCreationParams.withTags(tags); + return this; + } else { + this.updateUpdateParams.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderListResultImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderListResultImpl.java new file mode 100644 index 0000000000000..e869c3a7c7133 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderListResultImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +import com.azure.resourcemanager.attestation.AttestationManager; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner; +import com.azure.resourcemanager.attestation.models.AttestationProvider; +import com.azure.resourcemanager.attestation.models.AttestationProviderListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class AttestationProviderListResultImpl implements AttestationProviderListResult { + private AttestationProviderListResultInner innerObject; + + private final AttestationManager serviceManager; + + AttestationProviderListResultImpl( + AttestationProviderListResultInner innerObject, AttestationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new AttestationProviderImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AttestationProviderListResultInner innerModel() { + return this.innerObject; + } + + private AttestationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersClientImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersClientImpl.java new file mode 100644 index 0000000000000..8671963394f0a --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersClientImpl.java @@ -0,0 +1,1302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.attestation.fluent.AttestationProvidersClient; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner; +import com.azure.resourcemanager.attestation.models.AttestationServiceCreationParams; +import com.azure.resourcemanager.attestation.models.AttestationServicePatchParams; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AttestationProvidersClient. */ +public final class AttestationProvidersClientImpl implements AttestationProvidersClient { + private final ClientLogger logger = new ClientLogger(AttestationProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AttestationProvidersService service; + + /** The service client containing this operation class. */ + private final AttestationManagementClientImpl client; + + /** + * Initializes an instance of AttestationProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AttestationProvidersClientImpl(AttestationManagementClientImpl client) { + this.service = + RestProxy + .create(AttestationProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AttestationManagementClientAttestationProviders to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AttestationManagemen") + private interface AttestationProvidersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders/{providerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders/{providerName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AttestationServiceCreationParams creationParams, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders/{providerName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AttestationServicePatchParams updateParams, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders/{providerName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listDefault( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getDefaultByLocation( + @HostParam("$host") String endpoint, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String providerName) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @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 status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String providerName, 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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, + providerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String providerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, providerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderInner getByResourceGroup(String resourceGroupName, String providerName) { + return getByResourceGroupAsync(resourceGroupName, providerName).block(); + } + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @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 status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String providerName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, providerName, context).block(); + } + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String providerName, AttestationServiceCreationParams creationParams) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (creationParams == null) { + return Mono.error(new IllegalArgumentException("Parameter creationParams is required and cannot be null.")); + } else { + creationParams.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + creationParams, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String providerName, + AttestationServiceCreationParams creationParams, + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (creationParams == null) { + return Mono.error(new IllegalArgumentException("Parameter creationParams is required and cannot be null.")); + } else { + creationParams.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + creationParams, + accept, + context); + } + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String providerName, AttestationServiceCreationParams creationParams) { + return createWithResponseAsync(resourceGroupName, providerName, creationParams) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderInner create( + String resourceGroupName, String providerName, AttestationServiceCreationParams creationParams) { + return createAsync(resourceGroupName, providerName, creationParams).block(); + } + + /** + * Creates or updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param creationParams Client supplied parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String providerName, + AttestationServiceCreationParams creationParams, + Context context) { + return createWithResponseAsync(resourceGroupName, providerName, creationParams, context).block(); + } + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (updateParams == null) { + return Mono.error(new IllegalArgumentException("Parameter updateParams is required and cannot be null.")); + } else { + updateParams.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + updateParams, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams, 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + if (updateParams == null) { + return Mono.error(new IllegalArgumentException("Parameter updateParams is required and cannot be null.")); + } else { + updateParams.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + updateParams, + accept, + context); + } + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams) { + return updateWithResponseAsync(resourceGroupName, providerName, updateParams) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderInner update( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams) { + return updateAsync(resourceGroupName, providerName, updateParams).block(); + } + + /** + * Updates the Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @param updateParams Client supplied parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation service response message. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String providerName, AttestationServicePatchParams updateParams, Context context) { + return updateWithResponseAsync(resourceGroupName, providerName, updateParams, context).block(); + } + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 providerName) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @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 providerName, 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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, + providerName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 providerName) { + return deleteWithResponseAsync(resourceGroupName, providerName).flatMap((Response res) -> Mono.empty()); + } + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 providerName) { + deleteAsync(resourceGroupName, providerName).block(); + } + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String providerName, Context context) { + return deleteWithResponseAsync(resourceGroupName, providerName, context).block(); + } + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderListResultInner list() { + return listAsync().block(); + } + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupWithResponseAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupWithResponseAsync( + 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName 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 + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByResourceGroupAsync(String resourceGroupName) { + return listByResourceGroupWithResponseAsync(resourceGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderListResultInner listByResourceGroup(String resourceGroupName) { + return listByResourceGroupAsync(resourceGroupName).block(); + } + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByResourceGroupWithResponse( + String resourceGroupName, Context context) { + return listByResourceGroupWithResponseAsync(resourceGroupName, context).block(); + } + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDefaultWithResponseAsync() { + 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 + .listDefault( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listDefaultWithResponseAsync(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 + .listDefault( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listDefaultAsync() { + return listDefaultWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderListResultInner listDefault() { + return listDefaultAsync().block(); + } + + /** + * Get the default 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 default provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listDefaultWithResponse(Context context) { + return listDefaultWithResponseAsync(context).block(); + } + + /** + * Get the default provider by location. + * + * @param location The location of the default provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultByLocationWithResponseAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 + .getDefaultByLocation( + this.client.getEndpoint(), + location, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the default provider by location. + * + * @param location The location of the default 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 default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getDefaultByLocationWithResponseAsync( + String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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 + .getDefaultByLocation( + this.client.getEndpoint(), + location, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get the default provider by location. + * + * @param location The location of the default provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDefaultByLocationAsync(String location) { + return getDefaultByLocationWithResponseAsync(location) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the default provider by location. + * + * @param location The location of the default provider. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AttestationProviderInner getDefaultByLocation(String location) { + return getDefaultByLocationAsync(location).block(); + } + + /** + * Get the default provider by location. + * + * @param location The location of the default 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 default provider by location. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getDefaultByLocationWithResponse(String location, Context context) { + return getDefaultByLocationWithResponseAsync(location, context).block(); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersImpl.java new file mode 100644 index 0000000000000..5f75b063a35c5 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersImpl.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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.attestation.AttestationManager; +import com.azure.resourcemanager.attestation.fluent.AttestationProvidersClient; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner; +import com.azure.resourcemanager.attestation.models.AttestationProvider; +import com.azure.resourcemanager.attestation.models.AttestationProviderListResult; +import com.azure.resourcemanager.attestation.models.AttestationProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AttestationProvidersImpl implements AttestationProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationProvidersImpl.class); + + private final AttestationProvidersClient innerClient; + + private final AttestationManager serviceManager; + + public AttestationProvidersImpl(AttestationProvidersClient innerClient, AttestationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AttestationProvider getByResourceGroup(String resourceGroupName, String providerName) { + AttestationProviderInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, providerName); + if (inner != null) { + return new AttestationProviderImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String providerName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, providerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationProviderImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String providerName) { + this.serviceClient().delete(resourceGroupName, providerName); + } + + public Response deleteWithResponse(String resourceGroupName, String providerName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, providerName, context); + } + + public AttestationProviderListResult list() { + AttestationProviderListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new AttestationProviderListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationProviderListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AttestationProviderListResult listByResourceGroup(String resourceGroupName) { + AttestationProviderListResultInner inner = this.serviceClient().listByResourceGroup(resourceGroupName); + if (inner != null) { + return new AttestationProviderListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByResourceGroupWithResponse( + String resourceGroupName, Context context) { + Response inner = + this.serviceClient().listByResourceGroupWithResponse(resourceGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationProviderListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AttestationProviderListResult listDefault() { + AttestationProviderListResultInner inner = this.serviceClient().listDefault(); + if (inner != null) { + return new AttestationProviderListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listDefaultWithResponse(Context context) { + Response inner = this.serviceClient().listDefaultWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationProviderListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AttestationProvider getDefaultByLocation(String location) { + AttestationProviderInner inner = this.serviceClient().getDefaultByLocation(location); + if (inner != null) { + return new AttestationProviderImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getDefaultByLocationWithResponse(String location, Context context) { + Response inner = + this.serviceClient().getDefaultByLocationWithResponse(location, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AttestationProviderImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AttestationProvider 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 providerName = Utils.getValueFromIdByName(id, "attestationProviders"); + if (providerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attestationProviders'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, providerName, 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 providerName = Utils.getValueFromIdByName(id, "attestationProviders"); + if (providerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attestationProviders'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, providerName, 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 providerName = Utils.getValueFromIdByName(id, "attestationProviders"); + if (providerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attestationProviders'.", + id))); + } + this.deleteWithResponse(resourceGroupName, providerName, Context.NONE).getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String providerName = Utils.getValueFromIdByName(id, "attestationProviders"); + if (providerName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'attestationProviders'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, providerName, context); + } + + private AttestationProvidersClient serviceClient() { + return this.innerClient; + } + + private AttestationManager manager() { + return this.serviceManager; + } + + public AttestationProviderImpl define(String name) { + return new AttestationProviderImpl(name, this.manager()); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationListImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationListImpl.java new file mode 100644 index 0000000000000..ccc6e439e2637 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationListImpl.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.attestation.implementation; + +import com.azure.resourcemanager.attestation.AttestationManager; +import com.azure.resourcemanager.attestation.fluent.models.OperationListInner; +import com.azure.resourcemanager.attestation.models.OperationList; +import com.azure.resourcemanager.attestation.models.OperationsDefinition; +import java.util.Collections; +import java.util.List; + +public final class OperationListImpl implements OperationList { + private OperationListInner innerObject; + + private final AttestationManager serviceManager; + + OperationListImpl(OperationListInner innerObject, AttestationManager 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 AttestationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsClientImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..19fb1b16ca235 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsClientImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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.attestation.fluent.OperationsClient; +import com.azure.resourcemanager.attestation.fluent.models.OperationListInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final AttestationManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(AttestationManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AttestationManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AttestationManagemen") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Attestation/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available Azure attestation operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available Azure attestation operations. + * + * @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 list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + } + + /** + * Lists all of the available Azure attestation operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync() + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Lists all of the available Azure attestation operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListInner list() { + return listAsync().block(); + } + + /** + * Lists all of the available Azure attestation operations. + * + * @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 list of supported operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..b3e09fa7619f4 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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.attestation.AttestationManager; +import com.azure.resourcemanager.attestation.fluent.OperationsClient; +import com.azure.resourcemanager.attestation.fluent.models.OperationListInner; +import com.azure.resourcemanager.attestation.models.OperationList; +import com.azure.resourcemanager.attestation.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final AttestationManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, AttestationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OperationList list() { + OperationListInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private AttestationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/Utils.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/Utils.java new file mode 100644 index 0000000000000..bb545a6c7abec --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/Utils.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +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; + +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; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/package-info.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/package-info.java new file mode 100644 index 0000000000000..3a3eea9ab4eab --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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 AttestationManagementClient. Various APIs for managing resources in + * attestation service. This primarily encompasses per-tenant instance management. + */ +package com.azure.resourcemanager.attestation.implementation; diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProvider.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProvider.java new file mode 100644 index 0000000000000..12abe340e5eb3 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProvider.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.attestation.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import java.util.Map; + +/** An immutable client-side representation of AttestationProvider. */ +public interface AttestationProvider { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the trustModel property: Trust model for the attestation service instance. + * + * @return the trustModel value. + */ + String trustModel(); + + /** + * Gets the status property: Status of attestation service. + * + * @return the status value. + */ + AttestationServiceStatus status(); + + /** + * Gets the attestUri property: Gets the uri of attestation service. + * + * @return the attestUri value. + */ + String attestUri(); + + /** + * 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.attestation.fluent.models.AttestationProviderInner object. + * + * @return the inner object. + */ + AttestationProviderInner innerModel(); + + /** The entirety of the AttestationProvider definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The AttestationProvider definition stages. */ + interface DefinitionStages { + /** The first stage of the AttestationProvider definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AttestationProvider definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The supported Azure location where the attestation service instance should be created. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The supported Azure location where the attestation service instance should be created. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the AttestationProvider definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the AttestationProvider definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the attestation service instance. + * + * @param properties Properties of the attestation service instance. + * @return the next definition stage. + */ + WithCreate withProperties(AttestationServiceCreationSpecificParams properties); + } + /** + * The stage of the AttestationProvider definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + AttestationProvider create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AttestationProvider create(Context context); + } + /** The stage of the AttestationProvider definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags that will be assigned to the attestation service instance.. + * + * @param tags The tags that will be assigned to the attestation service instance. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the AttestationProvider resource. + * + * @return the stage of resource update. + */ + AttestationProvider.Update update(); + + /** The template for AttestationProvider update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AttestationProvider apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AttestationProvider apply(Context context); + } + /** The AttestationProvider update stages. */ + interface UpdateStages { + /** The stage of the AttestationProvider update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags that will be assigned to the attestation service instance.. + * + * @param tags The tags that will be assigned to the attestation service instance. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AttestationProvider refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AttestationProvider refresh(Context context); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviderListResult.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviderListResult.java new file mode 100644 index 0000000000000..3e0cff9e9693e --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviderListResult.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.attestation.models; + +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner; +import java.util.List; + +/** An immutable client-side representation of AttestationProviderListResult. */ +public interface AttestationProviderListResult { + /** + * Gets the value property: Attestation Provider array. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner object. + * + * @return the inner object. + */ + AttestationProviderListResultInner innerModel(); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviders.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviders.java new file mode 100644 index 0000000000000..3045b3dbb0e11 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviders.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AttestationProviders. */ +public interface AttestationProviders { + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @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 status of Attestation Provider. + */ + AttestationProvider getByResourceGroup(String resourceGroupName, String providerName); + + /** + * Get the status of Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service instance. + * @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 status of Attestation Provider. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String providerName, Context context); + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @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 providerName); + + /** + * Delete Attestation Service. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation service. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse(String resourceGroupName, String providerName, Context context); + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + AttestationProviderListResult list(); + + /** + * Returns a list of attestation providers in a 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 attestation Providers List. + */ + Response listWithResponse(Context context); + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + AttestationProviderListResult listByResourceGroup(String resourceGroupName); + + /** + * Returns attestation providers list in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return attestation Providers List. + */ + Response listByResourceGroupWithResponse(String resourceGroupName, Context context); + + /** + * Get the default 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 default provider. + */ + AttestationProviderListResult listDefault(); + + /** + * Get the default 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 default provider. + */ + Response listDefaultWithResponse(Context context); + + /** + * Get the default provider by location. + * + * @param location The location of the default provider. + * @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 default provider by location. + */ + AttestationProvider getDefaultByLocation(String location); + + /** + * Get the default provider by location. + * + * @param location The location of the default 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 default provider by location. + */ + Response getDefaultByLocationWithResponse(String location, Context context); + + /** + * Get the status of Attestation Provider. + * + * @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 status of Attestation Provider. + */ + AttestationProvider getById(String id); + + /** + * Get the status of Attestation Provider. + * + * @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 status of Attestation Provider. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete Attestation Service. + * + * @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 Attestation Service. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AttestationProvider resource. + * + * @param name resource name. + * @return the first stage of the new AttestationProvider definition. + */ + AttestationProvider.DefinitionStages.Blank define(String name); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationParams.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationParams.java new file mode 100644 index 0000000000000..7c60cfcb06e3d --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationParams.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters for creating an attestation service instance. */ +@Fluent +public final class AttestationServiceCreationParams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationServiceCreationParams.class); + + /* + * The supported Azure location where the attestation service instance + * should be created. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The tags that will be assigned to the attestation service instance. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Properties of the attestation service instance + */ + @JsonProperty(value = "properties", required = true) + private AttestationServiceCreationSpecificParams properties; + + /** + * Get the location property: The supported Azure location where the attestation service instance should be created. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The supported Azure location where the attestation service instance should be created. + * + * @param location the location value to set. + * @return the AttestationServiceCreationParams object itself. + */ + public AttestationServiceCreationParams withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: The tags that will be assigned to the attestation service instance. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags that will be assigned to the attestation service instance. + * + * @param tags the tags value to set. + * @return the AttestationServiceCreationParams object itself. + */ + public AttestationServiceCreationParams withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the properties property: Properties of the attestation service instance. + * + * @return the properties value. + */ + public AttestationServiceCreationSpecificParams properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the attestation service instance. + * + * @param properties the properties value to set. + * @return the AttestationServiceCreationParams object itself. + */ + public AttestationServiceCreationParams withProperties(AttestationServiceCreationSpecificParams properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model AttestationServiceCreationParams")); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property properties in model AttestationServiceCreationParams")); + } else { + properties().validate(); + } + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationSpecificParams.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationSpecificParams.java new file mode 100644 index 0000000000000..1d41b6d8cbc63 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationSpecificParams.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.attestation.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; + +/** Client supplied parameters used to create a new attestation service instance. */ +@Fluent +public final class AttestationServiceCreationSpecificParams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationServiceCreationSpecificParams.class); + + /* + * Name of attestation policy. + */ + @JsonProperty(value = "attestationPolicy") + private String attestationPolicy; + + /* + * JSON Web Key Set defining a set of X.509 Certificates that will + * represent the parent certificate for the signing certificate used for + * policy operations + */ + @JsonProperty(value = "policySigningCertificates") + private JsonWebKeySet policySigningCertificates; + + /** + * Get the attestationPolicy property: Name of attestation policy. + * + * @return the attestationPolicy value. + */ + public String attestationPolicy() { + return this.attestationPolicy; + } + + /** + * Set the attestationPolicy property: Name of attestation policy. + * + * @param attestationPolicy the attestationPolicy value to set. + * @return the AttestationServiceCreationSpecificParams object itself. + */ + public AttestationServiceCreationSpecificParams withAttestationPolicy(String attestationPolicy) { + this.attestationPolicy = attestationPolicy; + return this; + } + + /** + * Get the policySigningCertificates property: JSON Web Key Set defining a set of X.509 Certificates that will + * represent the parent certificate for the signing certificate used for policy operations. + * + * @return the policySigningCertificates value. + */ + public JsonWebKeySet policySigningCertificates() { + return this.policySigningCertificates; + } + + /** + * Set the policySigningCertificates property: JSON Web Key Set defining a set of X.509 Certificates that will + * represent the parent certificate for the signing certificate used for policy operations. + * + * @param policySigningCertificates the policySigningCertificates value to set. + * @return the AttestationServiceCreationSpecificParams object itself. + */ + public AttestationServiceCreationSpecificParams withPolicySigningCertificates( + JsonWebKeySet policySigningCertificates) { + this.policySigningCertificates = policySigningCertificates; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (policySigningCertificates() != null) { + policySigningCertificates().validate(); + } + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServicePatchParams.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServicePatchParams.java new file mode 100644 index 0000000000000..d8db0b6d7fb0d --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServicePatchParams.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters for patching an attestation service instance. */ +@Fluent +public final class AttestationServicePatchParams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationServicePatchParams.class); + + /* + * The tags that will be assigned to the attestation service instance. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: The tags that will be assigned to the attestation service instance. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags that will be assigned to the attestation service instance. + * + * @param tags the tags value to set. + * @return the AttestationServicePatchParams object itself. + */ + public AttestationServicePatchParams withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceStatus.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceStatus.java new file mode 100644 index 0000000000000..1057124fd1c92 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceStatus.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.attestation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AttestationServiceStatus. */ +public final class AttestationServiceStatus extends ExpandableStringEnum { + /** Static value Ready for AttestationServiceStatus. */ + public static final AttestationServiceStatus READY = fromString("Ready"); + + /** Static value NotReady for AttestationServiceStatus. */ + public static final AttestationServiceStatus NOT_READY = fromString("NotReady"); + + /** Static value Error for AttestationServiceStatus. */ + public static final AttestationServiceStatus ERROR = fromString("Error"); + + /** + * Creates or finds a AttestationServiceStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AttestationServiceStatus. + */ + @JsonCreator + public static AttestationServiceStatus fromString(String name) { + return fromString(name, AttestationServiceStatus.class); + } + + /** @return known AttestationServiceStatus values. */ + public static Collection values() { + return values(AttestationServiceStatus.class); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKey.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKey.java new file mode 100644 index 0000000000000..42aacb5c27247 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKey.java @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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 JsonWebKey model. */ +@Fluent +public final class JsonWebKey { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JsonWebKey.class); + + /* + * The "alg" (algorithm) parameter identifies the algorithm intended for + * use with the key. The values used should either be registered in the + * IANA "JSON Web Signature and Encryption Algorithms" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. + */ + @JsonProperty(value = "alg", required = true) + private String alg; + + /* + * The "crv" (curve) parameter identifies the curve type + */ + @JsonProperty(value = "crv") + private String crv; + + /* + * RSA private exponent or ECC private key + */ + @JsonProperty(value = "d") + private String d; + + /* + * RSA Private Key Parameter + */ + @JsonProperty(value = "dp") + private String dp; + + /* + * RSA Private Key Parameter + */ + @JsonProperty(value = "dq") + private String dq; + + /* + * RSA public exponent, in Base64 + */ + @JsonProperty(value = "e") + private String e; + + /* + * Symmetric key + */ + @JsonProperty(value = "k") + private String k; + + /* + * The "kid" (key ID) parameter is used to match a specific key. This + * is used, for instance, to choose among a set of keys within a JWK Set + * during key rollover. The structure of the "kid" value is + * unspecified. When "kid" values are used within a JWK Set, different + * keys within the JWK Set SHOULD use distinct "kid" values. (One + * example in which different keys might use the same "kid" value is if + * they have different "kty" (key type) values but are considered to be + * equivalent alternatives by the application using them.) The "kid" + * value is a case-sensitive string. + */ + @JsonProperty(value = "kid", required = true) + private String kid; + + /* + * The "kty" (key type) parameter identifies the cryptographic algorithm + * family used with the key, such as "RSA" or "EC". "kty" values should + * either be registered in the IANA "JSON Web Key Types" registry + * established by [JWA] or be a value that contains a Collision- + * Resistant Name. The "kty" value is a case-sensitive string. + */ + @JsonProperty(value = "kty", required = true) + private String kty; + + /* + * RSA modulus, in Base64 + */ + @JsonProperty(value = "n") + private String n; + + /* + * RSA secret prime + */ + @JsonProperty(value = "p") + private String p; + + /* + * RSA secret prime, with p < q + */ + @JsonProperty(value = "q") + private String q; + + /* + * RSA Private Key Parameter + */ + @JsonProperty(value = "qi") + private String qi; + + /* + * Use ("public key use") identifies the intended use of + * the public key. The "use" parameter is employed to indicate whether + * a public key is used for encrypting data or verifying the signature + * on data. Values are commonly "sig" (signature) or "enc" (encryption). + */ + @JsonProperty(value = "use", required = true) + private String use; + + /* + * X coordinate for the Elliptic Curve point + */ + @JsonProperty(value = "x") + private String x; + + /* + * The "x5c" (X.509 certificate chain) parameter contains a chain of one + * or more PKIX certificates [RFC5280]. The certificate chain is + * represented as a JSON array of certificate value strings. Each + * string in the array is a base64-encoded (Section 4 of [RFC4648] -- + * not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + * The PKIX certificate containing the key value MUST be the first + * certificate. + */ + @JsonProperty(value = "x5c") + private List x5C; + + /* + * Y coordinate for the Elliptic Curve point + */ + @JsonProperty(value = "y") + private String y; + + /** + * Get the alg property: The "alg" (algorithm) parameter identifies the algorithm intended for use with the key. The + * values used should either be registered in the IANA "JSON Web Signature and Encryption Algorithms" registry + * established by [JWA] or be a value that contains a Collision- Resistant Name. + * + * @return the alg value. + */ + public String alg() { + return this.alg; + } + + /** + * Set the alg property: The "alg" (algorithm) parameter identifies the algorithm intended for use with the key. The + * values used should either be registered in the IANA "JSON Web Signature and Encryption Algorithms" registry + * established by [JWA] or be a value that contains a Collision- Resistant Name. + * + * @param alg the alg value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withAlg(String alg) { + this.alg = alg; + return this; + } + + /** + * Get the crv property: The "crv" (curve) parameter identifies the curve type. + * + * @return the crv value. + */ + public String crv() { + return this.crv; + } + + /** + * Set the crv property: The "crv" (curve) parameter identifies the curve type. + * + * @param crv the crv value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withCrv(String crv) { + this.crv = crv; + return this; + } + + /** + * Get the d property: RSA private exponent or ECC private key. + * + * @return the d value. + */ + public String d() { + return this.d; + } + + /** + * Set the d property: RSA private exponent or ECC private key. + * + * @param d the d value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withD(String d) { + this.d = d; + return this; + } + + /** + * Get the dp property: RSA Private Key Parameter. + * + * @return the dp value. + */ + public String dp() { + return this.dp; + } + + /** + * Set the dp property: RSA Private Key Parameter. + * + * @param dp the dp value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withDp(String dp) { + this.dp = dp; + return this; + } + + /** + * Get the dq property: RSA Private Key Parameter. + * + * @return the dq value. + */ + public String dq() { + return this.dq; + } + + /** + * Set the dq property: RSA Private Key Parameter. + * + * @param dq the dq value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withDq(String dq) { + this.dq = dq; + return this; + } + + /** + * Get the e property: RSA public exponent, in Base64. + * + * @return the e value. + */ + public String e() { + return this.e; + } + + /** + * Set the e property: RSA public exponent, in Base64. + * + * @param e the e value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withE(String e) { + this.e = e; + return this; + } + + /** + * Get the k property: Symmetric key. + * + * @return the k value. + */ + public String k() { + return this.k; + } + + /** + * Set the k property: Symmetric key. + * + * @param k the k value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withK(String k) { + this.k = k; + return this; + } + + /** + * Get the kid property: The "kid" (key ID) parameter is used to match a specific key. This is used, for instance, + * to choose among a set of keys within a JWK Set during key rollover. The structure of the "kid" value is + * unspecified. When "kid" values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct + * "kid" values. (One example in which different keys might use the same "kid" value is if they have different "kty" + * (key type) values but are considered to be equivalent alternatives by the application using them.) The "kid" + * value is a case-sensitive string. + * + * @return the kid value. + */ + public String kid() { + return this.kid; + } + + /** + * Set the kid property: The "kid" (key ID) parameter is used to match a specific key. This is used, for instance, + * to choose among a set of keys within a JWK Set during key rollover. The structure of the "kid" value is + * unspecified. When "kid" values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct + * "kid" values. (One example in which different keys might use the same "kid" value is if they have different "kty" + * (key type) values but are considered to be equivalent alternatives by the application using them.) The "kid" + * value is a case-sensitive string. + * + * @param kid the kid value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withKid(String kid) { + this.kid = kid; + return this; + } + + /** + * Get the kty property: The "kty" (key type) parameter identifies the cryptographic algorithm family used with the + * key, such as "RSA" or "EC". "kty" values should either be registered in the IANA "JSON Web Key Types" registry + * established by [JWA] or be a value that contains a Collision- Resistant Name. The "kty" value is a case-sensitive + * string. + * + * @return the kty value. + */ + public String kty() { + return this.kty; + } + + /** + * Set the kty property: The "kty" (key type) parameter identifies the cryptographic algorithm family used with the + * key, such as "RSA" or "EC". "kty" values should either be registered in the IANA "JSON Web Key Types" registry + * established by [JWA] or be a value that contains a Collision- Resistant Name. The "kty" value is a case-sensitive + * string. + * + * @param kty the kty value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withKty(String kty) { + this.kty = kty; + return this; + } + + /** + * Get the n property: RSA modulus, in Base64. + * + * @return the n value. + */ + public String n() { + return this.n; + } + + /** + * Set the n property: RSA modulus, in Base64. + * + * @param n the n value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withN(String n) { + this.n = n; + return this; + } + + /** + * Get the p property: RSA secret prime. + * + * @return the p value. + */ + public String p() { + return this.p; + } + + /** + * Set the p property: RSA secret prime. + * + * @param p the p value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withP(String p) { + this.p = p; + return this; + } + + /** + * Get the q property: RSA secret prime, with p < q. + * + * @return the q value. + */ + public String q() { + return this.q; + } + + /** + * Set the q property: RSA secret prime, with p < q. + * + * @param q the q value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withQ(String q) { + this.q = q; + return this; + } + + /** + * Get the qi property: RSA Private Key Parameter. + * + * @return the qi value. + */ + public String qi() { + return this.qi; + } + + /** + * Set the qi property: RSA Private Key Parameter. + * + * @param qi the qi value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withQi(String qi) { + this.qi = qi; + return this; + } + + /** + * Get the use property: Use ("public key use") identifies the intended use of the public key. The "use" parameter + * is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. + * Values are commonly "sig" (signature) or "enc" (encryption). + * + * @return the use value. + */ + public String use() { + return this.use; + } + + /** + * Set the use property: Use ("public key use") identifies the intended use of the public key. The "use" parameter + * is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. + * Values are commonly "sig" (signature) or "enc" (encryption). + * + * @param use the use value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withUse(String use) { + this.use = use; + return this; + } + + /** + * Get the x property: X coordinate for the Elliptic Curve point. + * + * @return the x value. + */ + public String x() { + return this.x; + } + + /** + * Set the x property: X coordinate for the Elliptic Curve point. + * + * @param x the x value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withX(String x) { + this.x = x; + return this; + } + + /** + * Get the x5C property: The "x5c" (X.509 certificate chain) parameter contains a chain of one or more PKIX + * certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each + * string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] + * PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate. + * + * @return the x5C value. + */ + public List x5C() { + return this.x5C; + } + + /** + * Set the x5C property: The "x5c" (X.509 certificate chain) parameter contains a chain of one or more PKIX + * certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each + * string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] + * PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate. + * + * @param x5C the x5C value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withX5C(List x5C) { + this.x5C = x5C; + return this; + } + + /** + * Get the y property: Y coordinate for the Elliptic Curve point. + * + * @return the y value. + */ + public String y() { + return this.y; + } + + /** + * Set the y property: Y coordinate for the Elliptic Curve point. + * + * @param y the y value to set. + * @return the JsonWebKey object itself. + */ + public JsonWebKey withY(String y) { + this.y = y; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alg() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property alg in model JsonWebKey")); + } + if (kid() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property kid in model JsonWebKey")); + } + if (kty() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property kty in model JsonWebKey")); + } + if (use() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property use in model JsonWebKey")); + } + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKeySet.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKeySet.java new file mode 100644 index 0000000000000..be3cf7a359455 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKeySet.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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 JsonWebKeySet model. */ +@Fluent +public final class JsonWebKeySet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(JsonWebKeySet.class); + + /* + * The value of the "keys" parameter is an array of JWK values. By + * default, the order of the JWK values within the array does not imply + * an order of preference among them, although applications of JWK Sets + * can choose to assign a meaning to the order for their purposes, if + * desired. + */ + @JsonProperty(value = "keys") + private List keys; + + /** + * Get the keys property: The value of the "keys" parameter is an array of JWK values. By default, the order of the + * JWK values within the array does not imply an order of preference among them, although applications of JWK Sets + * can choose to assign a meaning to the order for their purposes, if desired. + * + * @return the keys value. + */ + public List keys() { + return this.keys; + } + + /** + * Set the keys property: The value of the "keys" parameter is an array of JWK values. By default, the order of the + * JWK values within the array does not imply an order of preference among them, although applications of JWK Sets + * can choose to assign a meaning to the order for their purposes, if desired. + * + * @param keys the keys value to set. + * @return the JsonWebKeySet object itself. + */ + public JsonWebKeySet withKeys(List keys) { + this.keys = keys; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (keys() != null) { + keys().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationList.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationList.java new file mode 100644 index 0000000000000..9067119b7a79c --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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.attestation.models; + +import com.azure.resourcemanager.attestation.fluent.models.OperationListInner; +import java.util.List; + +/** An immutable client-side representation of OperationList. */ +public interface OperationList { + /** + * Gets the value property: List of supported operations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.attestation.fluent.models.OperationListInner object. + * + * @return the inner object. + */ + OperationListInner innerModel(); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/Operations.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/Operations.java new file mode 100644 index 0000000000000..9d0f32b868ae3 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/Operations.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.attestation.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available Azure attestation operations. + * + * @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 list of supported operations. + */ + OperationList list(); + + /** + * Lists all of the available Azure attestation operations. + * + * @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 list of supported operations. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDefinition.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDefinition.java new file mode 100644 index 0000000000000..f28d9928e4539 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDefinition.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.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; + +/** Definition object with the name and properties of an operation. */ +@Fluent +public final class OperationsDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsDefinition.class); + + /* + * Name of the operation. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display object with properties of the operation. + */ + @JsonProperty(value = "display") + private OperationsDisplayDefinition display; + + /** + * Get the name property: Name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the operation. + * + * @param name the name value to set. + * @return the OperationsDefinition object itself. + */ + public OperationsDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display object with properties of the operation. + * + * @return the display value. + */ + public OperationsDisplayDefinition display() { + return this.display; + } + + /** + * Set the display property: Display object with properties of the operation. + * + * @param display the display value to set. + * @return the OperationsDefinition object itself. + */ + public OperationsDefinition withDisplay(OperationsDisplayDefinition 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/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDisplayDefinition.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDisplayDefinition.java new file mode 100644 index 0000000000000..4089d7bba14ae --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDisplayDefinition.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.attestation.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; + +/** Display object with properties of the operation. */ +@Fluent +public final class OperationsDisplayDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsDisplayDefinition.class); + + /* + * Resource provider of the operation. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource for the operation. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Short description of the operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * Description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Resource provider of the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Resource provider of the operation. + * + * @param provider the provider value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource for the operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource for the operation. + * + * @param resource the resource value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Short description of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Short description of the operation. + * + * @param operation the operation value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: Description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the operation. + * + * @param description the description value to set. + * @return the OperationsDisplayDefinition object itself. + */ + public OperationsDisplayDefinition withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/package-info.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/package-info.java new file mode 100644 index 0000000000000..b3bb67988af7e --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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 AttestationManagementClient. Various APIs for managing resources in + * attestation service. This primarily encompasses per-tenant instance management. + */ +package com.azure.resourcemanager.attestation.models; diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/package-info.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/package-info.java new file mode 100644 index 0000000000000..f26a1b94d0a62 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/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 AttestationManagementClient. Various APIs for managing resources in attestation + * service. This primarily encompasses per-tenant instance management. + */ +package com.azure.resourcemanager.attestation; diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/module-info.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/module-info.java new file mode 100644 index 0000000000000..9de05269d02e0 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/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.attestation { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.attestation; + exports com.azure.resourcemanager.attestation.fluent; + exports com.azure.resourcemanager.attestation.fluent.models; + exports com.azure.resourcemanager.attestation.models; + + opens com.azure.resourcemanager.attestation.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.attestation.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/attestation/ci.yml b/sdk/attestation/ci.yml new file mode 100644 index 0000000000000..69eddb6a5432f --- /dev/null +++ b/sdk/attestation/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/attestation/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/attestation/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: attestation + Artifacts: + - name: azure-resourcemanager-attestation + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerattestation diff --git a/sdk/attestation/pom.xml b/sdk/attestation/pom.xml new file mode 100644 index 0000000000000..f1fd24c57889c --- /dev/null +++ b/sdk/attestation/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-attestation-service + pom + 1.0.0 + + azure-resourcemanager-attestation + +