From 097ca3c0190eeb1b58543d1b35abf30aa6a610c0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 16 Mar 2021 06:45:27 +0000 Subject: [PATCH] CodeGen from PR 13435 in Azure/azure-rest-api-specs Merge 294957e4f61910eecd07b85ecff8648300181de9 into 7e7622058576795b3e20412f43333ae4c2217e2c --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 99 ++ .../azure-resourcemanager-attestation/pom.xml | 67 + .../attestation/AttestationManager.java | 242 +++ .../fluent/AttestationManagementClient.java | 67 + .../fluent/AttestationProvidersClient.java | 231 +++ .../attestation/fluent/OperationsClient.java | 36 + .../PrivateEndpointConnectionsClient.java | 148 ++ .../models/AttestationProviderInner.java | 158 ++ .../AttestationProviderListResultInner.java | 70 + .../fluent/models/OperationListInner.java | 71 + .../PrivateEndpointConnectionInner.java | 107 ++ .../fluent/models/package-info.java | 9 + .../attestation/fluent/package-info.java | 9 + .../AttestationManagementClientBuilder.java | 146 ++ .../AttestationManagementClientImpl.java | 321 ++++ .../AttestationProviderImpl.java | 221 +++ .../AttestationProviderListResultImpl.java | 53 + .../AttestationProvidersClientImpl.java | 1302 +++++++++++++++++ .../AttestationProvidersImpl.java | 255 ++++ .../implementation/OperationListImpl.java | 45 + .../implementation/OperationsClientImpl.java | 156 ++ .../implementation/OperationsImpl.java | 59 + .../PrivateEndpointConnectionImpl.java | 131 ++ .../PrivateEndpointConnectionsClientImpl.java | 849 +++++++++++ .../PrivateEndpointConnectionsImpl.java | 227 +++ .../attestation/implementation/Utils.java | 204 +++ .../implementation/package-info.java | 9 + .../models/AttestationProvider.java | 241 +++ .../models/AttestationProviderListResult.java | 33 + .../models/AttestationProviders.java | 200 +++ .../AttestationServiceCreationParams.java | 118 ++ ...estationServiceCreationSpecificParams.java | 58 + .../models/AttestationServicePatchParams.java | 51 + .../models/AttestationServiceStatus.java | 37 + .../attestation/models/JsonWebKey.java | 526 +++++++ .../attestation/models/JsonWebKeySet.java | 62 + .../attestation/models/OperationList.java | 33 + .../attestation/models/Operations.java | 31 + .../models/OperationsDefinition.java | 79 + .../models/OperationsDisplayDefinition.java | 128 ++ .../attestation/models/PrivateEndpoint.java | 39 + .../models/PrivateEndpointConnection.java | 143 ++ .../PrivateEndpointConnectionListResult.java | 55 + ...teEndpointConnectionProvisioningState.java | 41 + .../models/PrivateEndpointConnections.java | 149 ++ ...rivateEndpointServiceConnectionStatus.java | 38 + .../PrivateLinkServiceConnectionState.java | 108 ++ .../attestation/models/package-info.java | 9 + .../attestation/package-info.java | 9 + .../src/main/java/module-info.java | 19 + sdk/attestation/ci.yml | 4 +- sdk/attestation/pom.xml | 1 + 54 files changed, 7509 insertions(+), 1 deletion(-) create mode 100644 sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md create mode 100644 sdk/attestation/azure-resourcemanager-attestation/README.md create mode 100644 sdk/attestation/azure-resourcemanager-attestation/pom.xml create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/AttestationManager.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationManagementClient.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationProvidersClient.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/OperationsClient.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderInner.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderListResultInner.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/OperationListInner.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/package-info.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/package-info.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientBuilder.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderListResultImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersClientImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationListImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsClientImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationsImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/Utils.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/package-info.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProvider.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviderListResult.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviders.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationParams.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationSpecificParams.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServicePatchParams.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceStatus.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKey.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKeySet.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationList.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/Operations.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDefinition.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationsDisplayDefinition.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpoint.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnection.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionListResult.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionProvisioningState.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnections.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointServiceConnectionStatus.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/package-info.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/package-info.java create mode 100644 sdk/attestation/azure-resourcemanager-attestation/src/main/java/module-info.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index c0d601b4d5d2..ac47fbb77063 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -211,6 +211,7 @@ com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-apimanagement;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-attestation;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md b/sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md new file mode 100644 index 000000000000..a01acb564ab4 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-16) + +- 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-provider management. Package tag package-2020-10-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/attestation/azure-resourcemanager-attestation/README.md b/sdk/attestation/azure-resourcemanager-attestation/README.md new file mode 100644 index 000000000000..f883e9890e03 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/README.md @@ -0,0 +1,99 @@ +# 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-provider management. Package tag package-2020-10-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-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 + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/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 000000000000..dc749c962b9a --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/pom.xml @@ -0,0 +1,67 @@ + + 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. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Various APIs for managing resources in attestation service. This primarily encompasses per-provider management. Package tag package-2020-10-01. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + + + + + com.azure + azure-core + 1.14.0 + + + com.azure + azure-core-management + 1.2.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 000000000000..1fbba8163056 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/AttestationManager.java @@ -0,0 +1,242 @@ +// 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.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.attestation.models.AttestationProviders; +import com.azure.resourcemanager.attestation.models.Operations; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnections; +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-provider management. + */ +public final class AttestationManager { + private Operations operations; + + private AttestationProviders attestationProviders; + + private PrivateEndpointConnections privateEndpointConnections; + + 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."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.attestation") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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 Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * @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 000000000000..11d16457aa47 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/AttestationManagementClient.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.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(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); +} 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 000000000000..d2591bfca7c5 --- /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 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 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 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 status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String providerName, Context context); + + /** + * Creates a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 provider. + * @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 provider. + * @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 000000000000..709f15ffb2f0 --- /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/PrivateEndpointConnectionsClient.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..2bc3b18a7b99 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,148 @@ +// 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.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String providerName); + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String providerName, Context context); + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String providerName, String privateEndpointConnectionName); + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context); + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @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 Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner create( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties); + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @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 Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties, + Context context); + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String providerName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, 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 000000000000..eb87b8c43293 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderInner.java @@ -0,0 +1,158 @@ +// 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.management.SystemData; +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.List; +import java.util.Map; + +/** Attestation service response message. */ +@JsonFlatten +@Fluent +public class AttestationProviderInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationProviderInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Trust model for the attestation provider. + */ + @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; + + /* + * List of private endpoint connections associated with the attestation + * provider. + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the trustModel property: Trust model for the attestation provider. + * + * @return the trustModel value. + */ + public String trustModel() { + return this.trustModel; + } + + /** + * Set the trustModel property: Trust model for the attestation provider. + * + * @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; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections associated with the attestation + * provider. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** {@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() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.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 000000000000..309ce1537918 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/AttestationProviderListResultInner.java @@ -0,0 +1,70 @@ +// 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.management.SystemData; +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); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Attestation Provider array. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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 000000000000..72cade6b8a2e --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/OperationListInner.java @@ -0,0 +1,71 @@ +// 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.management.SystemData; +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); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * List of supported operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * 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/PrivateEndpointConnectionInner.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..ce8d7a32dda0 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.models.PrivateEndpoint; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.attestation.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint Connection resource. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * The resource of private end point. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between + * service consumer and provider. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The resource of private end point. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().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 000000000000..12be00f65a0b --- /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-provider 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 000000000000..9475b2b03142 --- /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-provider 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 000000000000..26932ca7a108 --- /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 000000000000..17d38574ea08 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationManagementClientImpl.java @@ -0,0 +1,321 @@ +// 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 com.azure.resourcemanager.attestation.fluent.PrivateEndpointConnectionsClient; +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; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * 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 = "2020-10-01"; + this.operations = new OperationsClientImpl(this); + this.attestationProviders = new AttestationProvidersClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/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 000000000000..8333eb375f26 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderImpl.java @@ -0,0 +1,221 @@ +// 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.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; +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 com.azure.resourcemanager.attestation.models.PrivateEndpointConnection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class AttestationProviderImpl + implements AttestationProvider, AttestationProvider.Definition, AttestationProvider.Update { + private AttestationProviderInner innerObject; + + private final com.azure.resourcemanager.attestation.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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String trustModel() { + return this.innerModel().trustModel(); + } + + public AttestationServiceStatus status() { + return this.innerModel().status(); + } + + public String attestUri() { + return this.innerModel().attestUri(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public AttestationProviderInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.attestation.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, com.azure.resourcemanager.attestation.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, com.azure.resourcemanager.attestation.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 000000000000..127a827f745e --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProviderListResultImpl.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +import com.azure.core.management.SystemData; +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 com.azure.resourcemanager.attestation.AttestationManager serviceManager; + + AttestationProviderListResultImpl( + AttestationProviderListResultInner innerObject, + com.azure.resourcemanager.attestation.AttestationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + 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 com.azure.resourcemanager.attestation.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 000000000000..3209fb82f2de --- /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 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 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 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 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 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 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 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 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 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 status of Attestation Provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String providerName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, providerName, context).block(); + } + + /** + * Creates a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 a new Attestation Provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName Name of the attestation provider. + * @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 provider. + * @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 provider. + * @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 provider. + * @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 provider. + * @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 provider. + * @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 000000000000..296a6081e270 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/AttestationProvidersImpl.java @@ -0,0 +1,255 @@ +// 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.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 com.azure.resourcemanager.attestation.AttestationManager serviceManager; + + public AttestationProvidersImpl( + AttestationProvidersClient innerClient, + com.azure.resourcemanager.attestation.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 com.azure.resourcemanager.attestation.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 000000000000..a866e68780bb --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/OperationListImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +import com.azure.core.management.SystemData; +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 com.azure.resourcemanager.attestation.AttestationManager serviceManager; + + OperationListImpl( + OperationListInner innerObject, com.azure.resourcemanager.attestation.AttestationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OperationListInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.attestation.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 000000000000..19fb1b16ca23 --- /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 000000000000..d464e4b5c99b --- /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.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 com.azure.resourcemanager.attestation.AttestationManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.attestation.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 com.azure.resourcemanager.attestation.AttestationManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..7a5413f9f66c --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,131 @@ +// 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.Context; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.attestation.models.PrivateEndpoint; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnection; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.attestation.models.PrivateLinkServiceConnectionState; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.attestation.AttestationManager serviceManager; + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.attestation.AttestationManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.attestation.AttestationManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String providerName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingAttestationProvider( + String resourceGroupName, String providerName) { + this.resourceGroupName = resourceGroupName; + this.providerName = providerName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createWithResponse( + resourceGroupName, providerName, privateEndpointConnectionName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createWithResponse( + resourceGroupName, providerName, privateEndpointConnectionName, this.innerModel(), context) + .getValue(); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.attestation.AttestationManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..2b495d6dc108 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,849 @@ +// 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.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnectionListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final AttestationManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(AttestationManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for AttestationManagementClientPrivateEndpointConnections to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "AttestationManagemen") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProvider/{providerName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @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/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation" + + "/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("providerName") String providerName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + 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 (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 (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(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + 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 (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 (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(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String providerName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, providerName)); + } + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String providerName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, providerName, context)); + } + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String providerName) { + return new PagedIterable<>(listAsync(resourceGroupName, providerName)); + } + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String providerName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, providerName, context)); + } + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String providerName, String privateEndpointConnectionName) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String providerName, String privateEndpointConnectionName, 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context); + } + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String providerName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, providerName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String providerName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, providerName, privateEndpointConnectionName).block(); + } + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, providerName, privateEndpointConnectionName, context).block(); + } + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + properties, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @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 Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties, + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + properties, + accept, + context); + } + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties) { + return createWithResponseAsync(resourceGroupName, providerName, privateEndpointConnectionName, properties) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner create( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties) { + return createAsync(resourceGroupName, providerName, privateEndpointConnectionName, properties).block(); + } + + /** + * Update the state of specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param properties The private endpoint connection properties. + * @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 Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String providerName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner properties, + Context context) { + return createWithResponseAsync( + resourceGroupName, providerName, privateEndpointConnectionName, properties, context) + .block(); + } + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String providerName, String privateEndpointConnectionName) { + 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String providerName, String privateEndpointConnectionName, 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 (providerName == null) { + return Mono.error(new IllegalArgumentException("Parameter providerName 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 (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + providerName, + this.client.getApiVersion(), + this.client.getSubscriptionId(), + privateEndpointConnectionName, + accept, + context); + } + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String providerName, String privateEndpointConnectionName) { + return deleteWithResponseAsync(resourceGroupName, providerName, privateEndpointConnectionName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String providerName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, providerName, privateEndpointConnectionName).block(); + } + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context) { + return deleteWithResponseAsync(resourceGroupName, providerName, privateEndpointConnectionName, context).block(); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsImpl.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..0748b7ce8c29 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,227 @@ +// 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.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnection; +import com.azure.resourcemanager.attestation.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.attestation.AttestationManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.attestation.AttestationManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String providerName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, providerName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String providerName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, providerName, context); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PrivateEndpointConnection get( + String resourceGroupName, String providerName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, providerName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String providerName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, providerName, privateEndpointConnectionName); + } + + public Response deleteWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context) { + return this + .serviceClient() + .deleteWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, context); + } + + public PrivateEndpointConnection 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))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, 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))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, 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))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this + .deleteWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, 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))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.deleteWithResponse(resourceGroupName, providerName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.attestation.AttestationManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} 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 000000000000..d05ef9cb7533 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/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 000000000000..38098d10c19a --- /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-provider 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 000000000000..9d3a8de42380 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProvider.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderInner; +import java.util.List; +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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the trustModel property: Trust model for the attestation provider. + * + * @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 privateEndpointConnections property: List of private endpoint connections associated with the + * attestation provider. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * 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 provider 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 provider 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 provider. + * + * @param properties Properties of the attestation provider. + * @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 provider.. + * + * @param tags The tags that will be assigned to the attestation provider. + * @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 provider.. + * + * @param tags The tags that will be assigned to the attestation provider. + * @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 000000000000..c57431957840 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationProviderListResult.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.attestation.fluent.models.AttestationProviderListResultInner; +import java.util.List; + +/** An immutable client-side representation of AttestationProviderListResult. */ +public interface AttestationProviderListResult { + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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 000000000000..75fabb8eeb84 --- /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 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 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 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 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 000000000000..fd91e599f046 --- /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 provider. */ +@Fluent +public final class AttestationServiceCreationParams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationServiceCreationParams.class); + + /* + * The supported Azure location where the attestation provider should be + * created. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * The tags that will be assigned to the attestation provider. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Properties of the attestation provider + */ + @JsonProperty(value = "properties", required = true) + private AttestationServiceCreationSpecificParams properties; + + /** + * Get the location property: The supported Azure location where the attestation provider should be created. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The supported Azure location where the attestation provider 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 provider. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags that will be assigned to the attestation provider. + * + * @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 provider. + * + * @return the properties value. + */ + public AttestationServiceCreationSpecificParams properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the attestation provider. + * + * @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 000000000000..8c63c1638db9 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/AttestationServiceCreationSpecificParams.java @@ -0,0 +1,58 @@ +// 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 provider. */ +@Fluent +public final class AttestationServiceCreationSpecificParams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationServiceCreationSpecificParams.class); + + /* + * 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 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 000000000000..795855e5dc6b --- /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 provider. */ +@Fluent +public final class AttestationServicePatchParams { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AttestationServicePatchParams.class); + + /* + * The tags that will be assigned to the attestation provider. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: The tags that will be assigned to the attestation provider. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags that will be assigned to the attestation provider. + * + * @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 000000000000..1057124fd1c9 --- /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 000000000000..98fcf13d3cb0 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/JsonWebKey.java @@ -0,0 +1,526 @@ +// 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") + 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") + 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") + 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 (kty() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property kty 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 000000000000..be3cf7a35945 --- /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 000000000000..d063ef08419c --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/OperationList.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.attestation.fluent.models.OperationListInner; +import java.util.List; + +/** An immutable client-side representation of OperationList. */ +public interface OperationList { + /** + * Gets the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * 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 000000000000..9d0f32b868ae --- /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 000000000000..f28d9928e453 --- /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 000000000000..4089d7bba14a --- /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/PrivateEndpoint.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpoint.java new file mode 100644 index 000000000000..2940c083e936 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpoint.java @@ -0,0 +1,39 @@ +// 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.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint resource. */ +@Immutable +public final class PrivateEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpoint.class); + + /* + * The ARM identifier for Private Endpoint + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** + * Get the id property: The ARM identifier for Private Endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * 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/PrivateEndpointConnection.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..640f0b964f1a --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnection.java @@ -0,0 +1,143 @@ +// 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.Context; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * 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 privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: A collection of information about the state of the + * connection between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, providerName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @return the next definition stage. + */ + WithCreate withExistingAttestationProvider(String resourceGroupName, String providerName); + } + /** + * The stage of the PrivateEndpointConnection 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.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The resource of private end point.. + * + * @param privateEndpoint The resource of private end point. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionListResult.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..f06ae82fd379 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionListResult.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.attestation.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of private endpoint connection associated with the specified storage account. */ +@Fluent +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResult object itself. + */ + public PrivateEndpointConnectionListResult 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/models/PrivateEndpointConnectionProvisioningState.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..394f3a195202 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointConnectionProvisioningState. */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** Static value Succeeded for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Creating for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + @JsonCreator + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** @return known PrivateEndpointConnectionProvisioningState values. */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnections.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..f195e71ee0e4 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointConnections.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + PagedIterable list(String resourceGroupName, String providerName); + + /** + * List all the private endpoint connections associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation 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 list of private endpoint connection associated with the specified storage account. + */ + PagedIterable list(String resourceGroupName, String providerName, Context context); + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + PrivateEndpointConnection get(String resourceGroupName, String providerName, String privateEndpointConnectionName); + + /** + * Gets the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified private endpoint connection associated with the attestation provider. + */ + Response getWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String providerName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection associated with the attestation provider. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param providerName The name of the attestation provider. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, String providerName, String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the 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 specified private endpoint connection associated with the attestation provider. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the 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 specified private endpoint connection associated with the attestation provider. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection associated with the 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. + */ + void deleteById(String id); + + /** + * Deletes the specified private endpoint connection associated with the 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 response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointServiceConnectionStatus.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..e7b3914fb899 --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.attestation.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointServiceConnectionStatus. */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** Static value Pending for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** @return known PrivateEndpointServiceConnectionStatus values. */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateLinkServiceConnectionState.java b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..968853517ccf --- /dev/null +++ b/sdk/attestation/azure-resourcemanager-attestation/src/main/java/com/azure/resourcemanager/attestation/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.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; + +/** A collection of information about the state of the connection between service consumer and provider. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionState.class); + + /* + * Indicates whether the connection has been Approved/Rejected/Removed by + * the owner of the service. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any + * updates on the consumer. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + 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 000000000000..0322f07d3999 --- /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-provider 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 000000000000..c959f7b5d6ca --- /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-provider 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 000000000000..9de05269d02e --- /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 index 3a13d33a0718..b653539ecc0b 100644 --- a/sdk/attestation/ci.yml +++ b/sdk/attestation/ci.yml @@ -40,4 +40,6 @@ extends: - name: azure-security-attestation groupId: com.azure safeName: azuresecurityattestation - \ No newline at end of file + - name: azure-resourcemanager-attestation + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerattestation diff --git a/sdk/attestation/pom.xml b/sdk/attestation/pom.xml index 31452759e129..db94236563e5 100644 --- a/sdk/attestation/pom.xml +++ b/sdk/attestation/pom.xml @@ -51,6 +51,7 @@ true + azure-resourcemanager-attestation azure-security-attestation