diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index 81c91fc0d5b91..c012ed292c27d 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -193,7 +193,7 @@ the main ServiceBusClientBuilder. --> + files="com.azure.containers.containerregistry.ContainerRegistryContentClient.java"/> diff --git a/eng/jacoco-test-coverage/pom.xml b/eng/jacoco-test-coverage/pom.xml index ffe480a2c381f..f81fe39162c00 100644 --- a/eng/jacoco-test-coverage/pom.xml +++ b/eng/jacoco-test-coverage/pom.xml @@ -318,17 +318,17 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 com.azure azure-storage-blob-batch - 12.18.0-beta.1 + 12.18.0-beta.2 com.azure @@ -338,7 +338,7 @@ com.azure azure-storage-blob-cryptography - 12.21.0-beta.1 + 12.21.0-beta.2 com.azure @@ -348,22 +348,22 @@ com.azure azure-storage-file-share - 12.18.0-beta.1 + 12.18.0-beta.2 com.azure azure-storage-file-datalake - 12.15.0-beta.1 + 12.15.0-beta.2 com.azure azure-storage-internal-avro - 12.7.0-beta.1 + 12.7.0-beta.2 com.azure azure-storage-queue - 12.17.0-beta.1 + 12.17.0-beta.2 com.azure diff --git a/eng/mgmt/automation/api-specs.yaml b/eng/mgmt/automation/api-specs.yaml index ec6e79a12d1c5..806096a3344fb 100644 --- a/eng/mgmt/automation/api-specs.yaml +++ b/eng/mgmt/automation/api-specs.yaml @@ -65,6 +65,8 @@ mysql: service: mysqlflexibleserver network: suffix: generated +newrelic: + service: newrelicobservability operationalinsights: service: loganalytics postgresql: diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ccfbdfc94a7ea..8bb9691e5aad3 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -161,17 +161,17 @@ com.azure:azure-sdk-template-two;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-sdk-template-three;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-spring-data-cosmos;3.33.0;3.34.0-beta.1 com.azure:azure-spring-data-cosmos-test;3.0.0-beta.1;3.0.0-beta.1 -com.azure:azure-storage-blob;12.21.1;12.22.0-beta.1 -com.azure:azure-storage-blob-batch;12.17.1;12.18.0-beta.1 +com.azure:azure-storage-blob;12.21.1;12.22.0-beta.2 +com.azure:azure-storage-blob-batch;12.17.1;12.18.0-beta.2 com.azure:azure-storage-blob-changefeed;12.0.0-beta.18;12.0.0-beta.19 -com.azure:azure-storage-blob-cryptography;12.20.1;12.21.0-beta.1 +com.azure:azure-storage-blob-cryptography;12.20.1;12.21.0-beta.2 com.azure:azure-storage-blob-nio;12.0.0-beta.19;12.0.0-beta.20 -com.azure:azure-storage-common;12.20.1;12.21.0-beta.1 -com.azure:azure-storage-file-share;12.17.1;12.18.0-beta.1 -com.azure:azure-storage-file-datalake;12.14.1;12.15.0-beta.1 -com.azure:azure-storage-internal-avro;12.6.1;12.7.0-beta.1 +com.azure:azure-storage-common;12.20.1;12.21.0-beta.2 +com.azure:azure-storage-file-share;12.17.1;12.18.0-beta.2 +com.azure:azure-storage-file-datalake;12.14.1;12.15.0-beta.2 +com.azure:azure-storage-internal-avro;12.6.1;12.7.0-beta.2 com.azure:azure-storage-perf;1.0.0-beta.1;1.0.0-beta.1 -com.azure:azure-storage-queue;12.16.1;12.17.0-beta.1 +com.azure:azure-storage-queue;12.16.1;12.17.0-beta.2 com.azure:azure-template-perf;1.0.0-beta.1;1.0.0-beta.1 com.azure:azure-media-videoanalyzer-edge;1.0.0-beta.6;1.0.0-beta.7 com.azure:azure-verticals-agrifood-farming;1.0.0-beta.3;1.0.0-beta.4 @@ -401,6 +401,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0-beta.1;1.0.0-beta.2 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 4d9066affde57..82e5754df1873 100644 --- a/pom.xml +++ b/pom.xml @@ -121,6 +121,7 @@ sdk/mysqlflexibleserver sdk/netapp sdk/networkfunction + sdk/newrelicobservability sdk/nginx sdk/notificationhubs sdk/oep diff --git a/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/DownloadBlobTests.java b/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/DownloadBlobTests.java index 469be0403916d..8dd17988faae8 100644 --- a/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/DownloadBlobTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/DownloadBlobTests.java @@ -5,6 +5,7 @@ import com.azure.containers.containerregistry.perf.core.ServiceTest; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import com.azure.perf.test.core.NullOutputStream; import com.azure.perf.test.core.PerfStressOptions; import reactor.core.publisher.Mono; @@ -36,13 +37,13 @@ public Mono setupAsync() { @Override public void run() { - blobClient.downloadStream(digest[0], Channels.newChannel(output), Context.NONE); + blobClient.downloadStream(digest[0], Channels.newChannel(output)); } @Override public Mono runAsync() { return blobAsyncClient.downloadStream(digest[0]) - .flatMap(result -> result.writeValueTo(Channels.newChannel(output))) + .flatMap(result -> FluxUtil.writeToOutputStream(result.toFluxByteBuffer(), output)) .then(); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/core/ServiceTest.java b/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/core/ServiceTest.java index 0a173d6778bb1..976d67210550e 100644 --- a/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/core/ServiceTest.java +++ b/sdk/containerregistry/azure-containers-containerregistry-perf/src/main/java/com/azure/containers/containerregistry/perf/core/ServiceTest.java @@ -6,9 +6,9 @@ import com.azure.containers.containerregistry.ContainerRegistryAsyncClient; import com.azure.containers.containerregistry.ContainerRegistryClient; import com.azure.containers.containerregistry.ContainerRegistryClientBuilder; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; +import com.azure.containers.containerregistry.ContainerRegistryContentAsyncClient; +import com.azure.containers.containerregistry.ContainerRegistryContentClient; +import com.azure.containers.containerregistry.ContainerRegistryContentClientBuilder; import com.azure.core.credential.TokenCredential; import com.azure.core.http.netty.NettyAsyncHttpClientProvider; import com.azure.core.http.okhttp.OkHttpAsyncClientProvider; @@ -60,8 +60,8 @@ public abstract class ServiceTest extends Pe */ protected ContainerRegistryAsyncClient containerRegistryAsyncClient; - protected ContainerRegistryBlobClient blobClient; - protected ContainerRegistryBlobAsyncClient blobAsyncClient; + protected ContainerRegistryContentClient blobClient; + protected ContainerRegistryContentAsyncClient blobAsyncClient; /** * The base class for Azure Container Registry performance tests. @@ -91,11 +91,11 @@ public ServiceTest(TOptions options) { this.containerRegistryClient = builder.buildClient(); this.containerRegistryAsyncClient = builder.buildAsyncClient(); - ContainerRegistryBlobClientBuilder blobClientBuilder = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClientBuilder blobClientBuilder = new ContainerRegistryContentClientBuilder() .credential(tokenCredential) .clientOptions(httpOptions) .endpoint(registryEndpoint) - .repository("oci-artifact"); + .repositoryName("oci-artifact"); this.blobClient = blobClientBuilder.buildClient(); this.blobAsyncClient = blobClientBuilder.buildAsyncClient(); diff --git a/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md b/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md index 8be1a6d4c47a2..dd7680baf7339 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md +++ b/sdk/containerregistry/azure-containers-containerregistry/CHANGELOG.md @@ -4,10 +4,22 @@ ### Features Added -### Breaking Changes - -- Replaced `uploadManifest(OciImageManifest)` method on `ContainerRegistryBlobClient` and `ContainerRegistryBlobAsyncClient` classes - with `uploadManifest(OciImageManifest manifest, String tag)` method. +### Breaking Changes from version 1.1.0-beta.3 + +- `ContainerRegistryBlobClientBuilder`, `ContainerRegistryBlobClient` and `ContainerRegistryBlobAsyncClient` were renamed to `ContainerRegistryContentClientBuilder`, + `ContainerRegistryContentClient`, and `ContainerRegistryContentAsyncClient` and moved to `com.azure.containers.containerregistry` package. +- `UploadBlobResult` was renamed to `UploadRegistryBlobResult` +- `ContainerRegistryContentClient` and `ContainerRegistryContentAsyncClient` changes: + - `uploadManifest` method was renamed to `setManifest`, `uploadManifestWithResponse` renamed to `setManifestWithResponse`, the return type of these methods was renamed to `SetManifestResult`. + `UploadManifestOptions` renamed to `SetManifestOptions`. + - `downloadManifest` method was renamed to `getManifest`, `downloadManifestWithResponse` renamed to `getManifestWithResponse`, the return type of these methods renamed to `GetManifestResult`. + - Removed `DownloadBlobAsyncResult` and changes `ContainerRegistryContentAsyncClient.downloadStream` return type to `Mono`. + - Removed `Collection mediaTypes` parameter from `downloadManifestWithResponse` method on blob clients. + - Renamed `ContainerRegistryContentClientBuilder.repository` method to `repositoryName`. +- Renamed `GetManifestResult.getMediaType` and `UploadManifestOptions.getMediaType` to `getManifestMediaType`. +- Removed `GetManifestResult.asOciManifest` - use `GetManifestResult.getManifest().toObject(OciImageManifest.class)` instead. +- Renamed `OciImageManifest.getConfig` and `setConfig` methods to `getConfiguration` and `setConfiguration`. +- Renamed `OciAnnotations.getCreated` and `setCreated` methods to `getCreatedOn` and `setCreatedOn`. ### Bugs Fixed @@ -183,8 +195,8 @@ ## 1.0.0 (2022-01-11) ### Breaking Changes - - Renamed `ArtifactTagOrderBy` to `ArtifactTagOrder`. - - Renamed `ArtifactManifestOrderBy` to `ArtifactManifestOrder`. + - Renamed `ArtifactTagOrderBy` to `ArtifactTagOrder`. + - Renamed `ArtifactManifestOrderBy` to `ArtifactManifestOrder`. ### Other Changes diff --git a/sdk/containerregistry/azure-containers-containerregistry/README.md b/sdk/containerregistry/azure-containers-containerregistry/README.md index 7cd0d1b180e2e..8cffc6ac6fe5d 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/README.md +++ b/sdk/containerregistry/azure-containers-containerregistry/README.md @@ -251,16 +251,16 @@ try { ### Blob and manifest operations -This section contains samples for `ContainerRegistryBlobClient` that show how to upload and download images. +This section contains samples for `ContainerRegistryContentClient` that show how to upload and download images. First, we need to create blob client. -```java readme-sample-createBlobClient +```java readme-sample-createContentClient DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); -ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() +ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(endpoint) .credential(credential) - .repository(repository) + .repositoryName(repository) .buildClient(); ``` @@ -272,7 +272,7 @@ which describes an image or artifact and assign it a tag. ```java readme-sample-uploadImage BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); -UploadBlobResult configUploadResult = blobClient.uploadBlob(configContent); +UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent); System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), configContent.getLength()); OciDescriptor configDescriptor = new OciDescriptor() @@ -281,11 +281,11 @@ OciDescriptor configDescriptor = new OciDescriptor() .setSizeInBytes(configContent.getLength()); BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry"); -UploadBlobResult layerUploadResult = blobClient.uploadBlob(layerContent); +UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent); System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), layerContent.getLength()); OciImageManifest manifest = new OciImageManifest() - .setConfig(configDescriptor) + .setConfiguration(configDescriptor) .setSchemaVersion(2) .setLayers(Collections.singletonList( new OciDescriptor() @@ -293,7 +293,7 @@ OciImageManifest manifest = new OciImageManifest() .setSizeInBytes(layerContent.getLength()) .setMediaType("application/octet-stream"))); -UploadManifestResult manifestResult = blobClient.uploadManifest(manifest, "latest"); +SetManifestResult manifestResult = contentClient.setManifest(manifest, "latest"); System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest()); ``` @@ -302,17 +302,17 @@ System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest() To download a full image, we need to download its manifest and then download individual layers and configuration. ```java readme-sample-downloadImage -DownloadManifestResult manifestResult = blobClient.downloadManifest("latest"); +GetManifestResult manifestResult = contentClient.getManifest("latest"); -OciImageManifest manifest = manifestResult.asOciManifest(); +OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class); System.out.printf("Got manifest:\n%s\n", PRETTY_PRINT.writeValueAsString(manifest)); -String configFileName = manifest.getConfig().getDigest() + ".json"; -blobClient.downloadStream(manifest.getConfig().getDigest(), createFileChannel(configFileName)); +String configFileName = manifest.getConfiguration().getDigest() + ".json"; +contentClient.downloadStream(manifest.getConfiguration().getDigest(), createFileChannel(configFileName)); System.out.printf("Got config: %s\n", configFileName); for (OciDescriptor layer : manifest.getLayers()) { - blobClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest())); + contentClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest())); System.out.printf("Got layer: %s\n", layer.getDigest()); } ``` @@ -320,19 +320,19 @@ for (OciDescriptor layer : manifest.getLayers()) { #### Delete blob ```java readme-sample-deleteBlob -DownloadManifestResult manifestResult = blobClient.downloadManifest("latest"); +GetManifestResult manifestResult = contentClient.getManifest("latest"); -OciImageManifest manifest = manifestResult.asOciManifest(); +OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class); for (OciDescriptor layer : manifest.getLayers()) { - blobClient.deleteBlob(layer.getDigest()); + contentClient.deleteBlob(layer.getDigest()); } ``` #### Delete manifest ```java readme-sample-deleteManifest -DownloadManifestResult manifestResult = blobClient.downloadManifest("latest"); -blobClient.deleteManifest(manifestResult.getDigest()); +GetManifestResult manifestResult = contentClient.getManifest("latest"); +contentClient.deleteManifest(manifestResult.getDigest()); ``` ## Troubleshooting diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobAsyncClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java similarity index 76% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobAsyncClient.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java index 562bebc18c92d..91bb0ac3782ca 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobAsyncClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentAsyncClient.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.containers.containerregistry.specialized; +package com.azure.containers.containerregistry; import com.azure.containers.containerregistry.implementation.AzureContainerRegistryImpl; import com.azure.containers.containerregistry.implementation.ConstructorAccessors; @@ -9,13 +9,12 @@ import com.azure.containers.containerregistry.implementation.ContainerRegistryBlobsImpl; import com.azure.containers.containerregistry.implementation.UtilsImpl; import com.azure.containers.containerregistry.implementation.models.ContainerRegistryBlobsGetChunkHeaders; -import com.azure.containers.containerregistry.models.DownloadBlobAsyncResult; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.models.UploadBlobResult; -import com.azure.containers.containerregistry.models.UploadManifestOptions; -import com.azure.containers.containerregistry.models.UploadManifestResult; +import com.azure.containers.containerregistry.models.UploadRegistryBlobResult; +import com.azure.containers.containerregistry.models.SetManifestOptions; +import com.azure.containers.containerregistry.models.SetManifestResult; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -39,7 +38,6 @@ import java.nio.ByteBuffer; import java.security.MessageDigest; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; @@ -48,13 +46,14 @@ import static com.azure.containers.containerregistry.implementation.UtilsImpl.CHUNK_SIZE; import static com.azure.containers.containerregistry.implementation.UtilsImpl.DOCKER_DIGEST_HEADER_NAME; import static com.azure.containers.containerregistry.implementation.UtilsImpl.DOWNLOAD_BLOB_SPAN_NAME; +import static com.azure.containers.containerregistry.implementation.UtilsImpl.SUPPORTED_MANIFEST_TYPES; import static com.azure.containers.containerregistry.implementation.UtilsImpl.UPLOAD_BLOB_SPAN_NAME; import static com.azure.containers.containerregistry.implementation.UtilsImpl.computeDigest; import static com.azure.containers.containerregistry.implementation.UtilsImpl.createSha256; import static com.azure.containers.containerregistry.implementation.UtilsImpl.getBlobSize; -import static com.azure.containers.containerregistry.implementation.UtilsImpl.getContentTypeString; import static com.azure.containers.containerregistry.implementation.UtilsImpl.getLocation; -import static com.azure.containers.containerregistry.implementation.UtilsImpl.toDownloadManifestResponse; +import static com.azure.containers.containerregistry.implementation.UtilsImpl.toGetManifestResponse; +import static com.azure.containers.containerregistry.implementation.UtilsImpl.validateDigest; import static com.azure.containers.containerregistry.implementation.UtilsImpl.validateResponseHeaderDigest; import static com.azure.core.util.CoreUtils.bytesToHexString; import static com.azure.core.util.FluxUtil.monoError; @@ -64,20 +63,20 @@ * This class provides a client that exposes operations to push and pull images into container registry. * It exposes methods that upload, download and delete artifacts from the registry i.e. images and manifests. * - *

View {@link ContainerRegistryBlobClientBuilder this} for additional ways to construct the client.

+ *

View {@link ContainerRegistryContentClientBuilder this} for additional ways to construct the client.

* - * @see ContainerRegistryBlobClientBuilder + * @see ContainerRegistryContentClientBuilder */ -@ServiceClient(builder = ContainerRegistryBlobClientBuilder.class, isAsync = true) -public final class ContainerRegistryBlobAsyncClient { +@ServiceClient(builder = ContainerRegistryContentClientBuilder.class, isAsync = true) +public final class ContainerRegistryContentAsyncClient { private final ContainerRegistryBlobsImpl blobsImpl; private final ContainerRegistriesImpl registriesImpl; private final String endpoint; private final String repositoryName; private final Tracer tracer; - private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryBlobAsyncClient.class); + private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryContentAsyncClient.class); - ContainerRegistryBlobAsyncClient(String repositoryName, HttpPipeline httpPipeline, String endpoint, String version, Tracer tracer) { + ContainerRegistryContentAsyncClient(String repositoryName, HttpPipeline httpPipeline, String endpoint, String version, Tracer tracer) { this.repositoryName = repositoryName; this.endpoint = endpoint; AzureContainerRegistryImpl registryImplClient = new AzureContainerRegistryImpl(httpPipeline, endpoint, version); @@ -109,15 +108,15 @@ public String getEndpoint() { * *

Code Samples:

* - * + * *
      * OciImageManifest manifest = new OciImageManifest()
-     *         .setConfig(configDescriptor)
+     *         .setConfiguration(configDescriptor)
      *         .setSchemaVersion(2)
      *         .setLayers(Collections.singletonList(layerDescriptor));
-     * Mono<UploadManifestResult> result = blobClient.uploadManifest(manifest, "latest");
+     * Mono<SetManifestResult> result = contentClient.setManifest(manifest, "latest");
      * 
- * + * * * @see Oci Manifest Specification * @param manifest The {@link OciImageManifest} that needs to be uploaded. @@ -127,12 +126,12 @@ public String getEndpoint() { * @throws NullPointerException thrown if the {@code manifest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono uploadManifest(OciImageManifest manifest, String tag) { + public Mono setManifest(OciImageManifest manifest, String tag) { if (manifest == null) { return monoError(LOGGER, new NullPointerException("'manifest' can't be null.")); } - return withContext(context -> uploadManifestWithResponse(BinaryData.fromObject(manifest), tag, ManifestMediaType.OCI_MANIFEST, context)) + return withContext(context -> setManifestWithResponse(BinaryData.fromObject(manifest), tag, ManifestMediaType.OCI_MANIFEST, context)) .flatMap(FluxUtil::toMono); } @@ -143,10 +142,10 @@ public Mono uploadManifest(OciImageManifest manifest, Stri * * *
-     * UploadManifestOptions options = new UploadManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE)
+     * SetManifestOptions options = new SetManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE)
      *     .setTag("v2");
      *
-     * blobClient.uploadManifestWithResponse(options)
+     * contentClient.setManifestWithResponse(options)
      *     .subscribe(response ->
      *         System.out.println("Manifest uploaded, digest - " + response.getValue().getDigest()));
      * 
@@ -159,12 +158,12 @@ public Mono uploadManifest(OciImageManifest manifest, Stri * @throws NullPointerException thrown if the {@code data} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> uploadManifestWithResponse(UploadManifestOptions options) { + public Mono> setManifestWithResponse(SetManifestOptions options) { if (options == null) { return monoError(LOGGER, new NullPointerException("'options' can't be null.")); } - return withContext(context -> this.uploadManifestWithResponse(options.getManifest(), options.getTag(), options.getMediaType(), context)); + return withContext(context -> this.setManifestWithResponse(options.getManifest(), options.getTag(), options.getManifestMediaType(), context)); } /** @@ -176,7 +175,7 @@ public Mono> uploadManifestWithResponse(UploadMan *
      * BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world"));
      *
-     * blobClient
+     * contentClient
      *     .uploadBlob(configContent)
      *     .subscribe(uploadResult -> System.out.printf("Uploaded blob: digest - '%s', size - %s\n",
      *             uploadResult.getDigest(), uploadResult.getSizeInBytes()));
@@ -187,18 +186,18 @@ public Mono> uploadManifestWithResponse(UploadMan
      * sizes. Buffers that are bigger than 4MB are broken down into smaller chunks, but small buffers are not aggregated.
      * To decrease number of chunks for big content, use buffers of 4MB size.
      *
-     * @param data The blob content that needs to be uploaded.
+     * @param content The blob content that needs to be uploaded.
      * @return The operation result.
      * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace.
      * @throws NullPointerException thrown if the {@code data} is null.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono uploadBlob(BinaryData data) {
-        if (data == null) {
-            return monoError(LOGGER, new NullPointerException("'data' can't be null."));
+    public Mono uploadBlob(BinaryData content) {
+        if (content == null) {
+            return monoError(LOGGER, new NullPointerException("'content' can't be null."));
         }
 
-        return uploadBlob(data.toFluxByteBuffer());
+        return uploadBlob(content.toFluxByteBuffer());
     }
 
     /**
@@ -210,7 +209,7 @@ public Mono uploadBlob(BinaryData data) {
      * 
      * Flux.using(
      *         () -> new FileInputStream("artifact.tar.gz"),
-     *         fileStream -> blobClient.uploadBlob(FluxUtil.toFluxByteBuffer(fileStream, CHUNK_SIZE)),
+     *         fileStream -> contentClient.uploadBlob(FluxUtil.toFluxByteBuffer(fileStream, CHUNK_SIZE)),
      *         this::closeStream)
      *     .subscribe(uploadResult ->
      *         System.out.printf("Uploaded blob: digest - '%s', size - %s\n",
@@ -222,14 +221,14 @@ public Mono uploadBlob(BinaryData data) {
      * sizes. Buffers that are bigger than 4MB are broken down into smaller chunks, but small buffers are not aggregated.
      * To decrease number of chunks for big content, use buffers of 4MB size.
      *
-     * @param data The blob content that needs to be uploaded.
+     * @param content The blob content that needs to be uploaded.
      * @return The rest response containing the operation result.
      * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace.
      * @throws NullPointerException thrown if the {@code data} is null.
      */
     @ServiceMethod(returns = ReturnType.SINGLE)
-    public Mono uploadBlob(Flux data) {
-        return withContext(context -> runWithTracing(UPLOAD_BLOB_SPAN_NAME, span -> uploadBlob(data, span), context));
+    public Mono uploadBlob(Flux content) {
+        return withContext(context -> runWithTracing(UPLOAD_BLOB_SPAN_NAME, span -> uploadBlob(content, span), context));
     }
 
     /**
@@ -237,21 +236,21 @@ public Mono uploadBlob(Flux data) {
      *
      * 

Code Samples:

* - * + * *
-     * blobClient.downloadManifest("latest")
+     * contentClient.getManifest("latest")
      *     .doOnNext(downloadResult -> {
-     *         if (ManifestMediaType.OCI_MANIFEST.equals(downloadResult.getMediaType())
-     *             || ManifestMediaType.DOCKER_MANIFEST.equals(downloadResult.getMediaType())) {
-     *             OciImageManifest manifest = downloadResult.asOciManifest();
+     *         if (ManifestMediaType.OCI_MANIFEST.equals(downloadResult.getManifestMediaType())
+     *             || ManifestMediaType.DOCKER_MANIFEST.equals(downloadResult.getManifestMediaType())) {
+     *             OciImageManifest manifest = downloadResult.getManifest().toObject(OciImageManifest.class);
      *             System.out.println("Got OCI manifest");
      *         } else {
-     *             throw new IllegalArgumentException("Unexpected manifest type: " + downloadResult.getMediaType());
+     *             throw new IllegalArgumentException("Unexpected manifest type: " + downloadResult.getManifestMediaType());
      *         }
      *     })
      *     .block();
      * 
- * + * * * @see Oci Manifest Specification * @@ -261,8 +260,8 @@ public Mono uploadBlob(Flux data) { * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadManifest(String tagOrDigest) { - return withContext(context -> this.downloadManifestWithResponse(tagOrDigest, null, context)).flatMap(FluxUtil::toMono); + public Mono getManifest(String tagOrDigest) { + return withContext(context -> this.getManifestWithResponse(tagOrDigest, context)).flatMap(FluxUtil::toMono); } /** @@ -270,40 +269,31 @@ public Mono downloadManifest(String tagOrDigest) { * *

Code Samples:

* - * + * *
-     * ManifestMediaType dockerListType = ManifestMediaType
-     *     .fromString("application/vnd.docker.distribution.manifest.list.v2+json");
-     * ManifestMediaType ociIndexType = ManifestMediaType
-     *     .fromString("application/vnd.oci.image.index.v1+json");
-     *
-     * blobClient.downloadManifestWithResponse("latest", Arrays.asList(dockerListType, ociIndexType))
-     *     .doOnNext(downloadResult -> {
-     *         if (dockerListType.equals(downloadResult.getValue().getMediaType())) {
-     *             // DockerManifestList manifestList =
-     *             //     downloadResult.getValue().getContent().toObject(DockerManifestList.class);
-     *             System.out.println("Got docker manifest list");
-     *         } else if (ociIndexType.equals(downloadResult.getValue().getMediaType())) {
-     *             // OciIndex ociIndex = downloadResult.getValue().getContent().toObject(OciIndex.class);
-     *             System.out.println("Got OCI index");
+     * contentClient.getManifestWithResponse("latest")
+     *     .doOnNext(response -> {
+     *         GetManifestResult manifestResult = response.getValue();
+     *         if (ManifestMediaType.OCI_MANIFEST.equals(manifestResult.getManifestMediaType())
+     *             || ManifestMediaType.DOCKER_MANIFEST.equals(manifestResult.getManifestMediaType())) {
+     *             OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class);
+     *             System.out.println("Got OCI manifest");
      *         } else {
-     *             throw new IllegalArgumentException("Got unexpected content type: "
-     *                 + downloadResult.getValue().getMediaType());
+     *             throw new IllegalArgumentException("Unexpected manifest type: " + manifestResult.getManifestMediaType());
      *         }
      *     })
      *     .block();
      * 
- * + * * * @param tagOrDigest Manifest reference which can be tag or digest. - * @param mediaTypes List of {@link ManifestMediaType} to request. * @return The response for the manifest identified by the given tag or digest. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> downloadManifestWithResponse(String tagOrDigest, Collection mediaTypes) { - return withContext(context -> this.downloadManifestWithResponse(tagOrDigest, mediaTypes, context)); + public Mono> getManifestWithResponse(String tagOrDigest) { + return withContext(context -> this.getManifestWithResponse(tagOrDigest, context)); } /** @@ -316,11 +306,12 @@ public Mono> downloadManifestWithResponse(Strin * * *
-     * blobClient
+     * contentClient
      *     .downloadStream(digest)
      *     .flatMap(downloadResult ->
      *         Mono.using(() -> new FileOutputStream(trimSha(digest)),
-     *             fileStream -> downloadResult.writeValueTo(fileStream.getChannel()),
+     *             fileStream -> FluxUtil.writeToWritableByteChannel(
+     *                 downloadResult.toFluxByteBuffer(), fileStream.getChannel()),
      *             fileStream -> closeStream(fileStream)))
      *     .block();
      * 
@@ -330,12 +321,12 @@ public Mono> downloadManifestWithResponse(Strin * * *
-     * blobClient
+     * contentClient
      *     .downloadStream(digest)
      *     .flatMap(downloadResult ->
      *         Mono.using(
      *             () -> openSocket(),
-     *             socket -> downloadResult.writeValueToAsync(socket),
+     *             socket -> FluxUtil.writeToAsynchronousByteChannel(downloadResult.toFluxByteBuffer(), socket),
      *             socket -> closeStream(socket)))
      *     .block();
      * 
@@ -347,7 +338,7 @@ public Mono> downloadManifestWithResponse(Strin * @throws NullPointerException thrown if the {@code digest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono downloadStream(String digest) { + public Mono downloadStream(String digest) { return withContext(context -> runWithTracing(DOWNLOAD_BLOB_SPAN_NAME, span -> downloadBlobInternal(digest, span), context)); } @@ -359,8 +350,8 @@ public Mono downloadStream(String digest) { * * *
-     * blobClient.downloadManifest("latest")
-     *     .flatMap(manifest -> blobClient.deleteBlob(manifest.getDigest()))
+     * contentClient.getManifest("latest")
+     *     .flatMap(manifest -> contentClient.deleteBlob(manifest.getDigest()))
      *     .block();
      * 
* @@ -395,8 +386,8 @@ public Mono> deleteBlobWithResponse(String digest) { * * *
-     * blobClient.downloadManifest("latest")
-     *     .flatMap(manifest -> blobClient.deleteManifest(manifest.getDigest()))
+     * contentClient.getManifest("latest")
+     *     .flatMap(manifest -> contentClient.deleteManifest(manifest.getDigest()))
      *     .block();
      * 
* @@ -424,7 +415,7 @@ public Mono> deleteManifestWithResponse(String digest) { return withContext(context -> deleteManifestWithResponse(digest, context)); } - private Mono> uploadManifestWithResponse(BinaryData manifestData, String tagOrDigest, ManifestMediaType manifestMediaType, Context context) { + private Mono> setManifestWithResponse(BinaryData manifestData, String tagOrDigest, ManifestMediaType manifestMediaType, Context context) { ByteBuffer data = manifestData.toByteBuffer(); if (tagOrDigest == null) { tagOrDigest = computeDigest(data); @@ -438,26 +429,24 @@ private Mono> uploadManifestWithResponse(BinaryDa data.remaining(), manifestMediaType.toString(), context) - .map(response -> (Response) + .map(response -> (Response) new ResponseBase<>( response.getRequest(), response.getStatusCode(), response.getHeaders(), - ConstructorAccessors.createUploadManifestResult(response.getDeserializedHeaders().getDockerContentDigest()), + ConstructorAccessors.createSetManifestResult(response.getDeserializedHeaders().getDockerContentDigest()), response.getDeserializedHeaders())) .onErrorMap(UtilsImpl::mapException); } - private Mono> downloadManifestWithResponse(String tagOrDigest, Collection mediaTypes, Context context) { + private Mono> getManifestWithResponse(String tagOrDigest, Context context) { if (tagOrDigest == null) { return monoError(LOGGER, new NullPointerException("'tagOrDigest' can't be null.")); } - String requestMediaTypes = getContentTypeString(mediaTypes); - - return registriesImpl.getManifestWithResponseAsync(repositoryName, tagOrDigest, requestMediaTypes, context) - .map(response -> toDownloadManifestResponse(tagOrDigest, response)) + return registriesImpl.getManifestWithResponseAsync(repositoryName, tagOrDigest, SUPPORTED_MANIFEST_TYPES, context) + .map(response -> toGetManifestResponse(tagOrDigest, response)) .onErrorMap(UtilsImpl::mapException); } @@ -497,7 +486,7 @@ private static Flux chunkSource(Flux data, MessageDigest }, 1, 1); } - private Mono downloadBlobInternal(String digest, Context context) { + private Mono downloadBlobInternal(String digest, Context context) { if (digest == null) { return monoError(LOGGER, new NullPointerException("'digest' can't be null.")); } @@ -506,7 +495,14 @@ private Mono downloadBlobInternal(String digest, Contex blobsImpl.getChunkWithResponseAsync(repositoryName, digest, new HttpRange(0, (long) CHUNK_SIZE).toString(), context) .flatMapMany(firstResponse -> getAllChunks(firstResponse, digest, context)) .flatMapSequential(chunk -> chunk.getValue().toFluxByteBuffer(), 1); - return Mono.just(ConstructorAccessors.createDownloadBlobResult(digest, content)); + + MessageDigest sha256 = createSha256(); + content = content + .doOnNext(buffer -> sha256.update(buffer.asReadOnlyBuffer())) + .doOnComplete(() -> validateDigest(sha256, digest)) + .doOnError(UtilsImpl::mapException); + + return BinaryData.fromFlux(content, null, false); } private Flux> getAllChunks( @@ -555,21 +551,21 @@ private Mono upload(Flux data, String location, Context cont .last(); } - private Mono uploadBlob(Flux data, Context context) { - if (data == null) { - return monoError(LOGGER, new NullPointerException("'data' can't be null.")); + private Mono uploadBlob(Flux content, Context context) { + if (content == null) { + return monoError(LOGGER, new NullPointerException("'content' can't be null.")); } AtomicLong streamLength = new AtomicLong(0); MessageDigest sha256 = createSha256(); - Flux chunks = chunkSource(data, sha256, streamLength); + Flux chunks = chunkSource(content, sha256, streamLength); return blobsImpl .startUploadWithResponseAsync(repositoryName, context) .flatMap(response -> upload(chunks, getLocation(response), context)) // TODO (limolkova) if we knew when's the last chunk, we could upload it in complete call instead. .flatMap(location -> blobsImpl.completeUploadWithResponseAsync("sha256:" + bytesToHexString(sha256.digest()), location, (BinaryData) null, 0L, context)) - .map(response -> ConstructorAccessors.createUploadBlobResult(response.getHeaders().getValue(DOCKER_DIGEST_HEADER_NAME), streamLength.get())) + .map(response -> ConstructorAccessors.createUploadRegistryBlobResult(response.getHeaders().getValue(DOCKER_DIGEST_HEADER_NAME), streamLength.get())) .onErrorMap(UtilsImpl::mapException); } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobClient.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java similarity index 74% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobClient.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java index 10f8b340d73f7..03f9c58765559 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobClient.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClient.java @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.containers.containerregistry.specialized; +package com.azure.containers.containerregistry; import com.azure.containers.containerregistry.implementation.AzureContainerRegistryImpl; import com.azure.containers.containerregistry.implementation.ConstructorAccessors; @@ -13,12 +13,12 @@ import com.azure.containers.containerregistry.implementation.models.ContainerRegistryBlobsCompleteUploadHeaders; import com.azure.containers.containerregistry.implementation.models.ContainerRegistryBlobsStartUploadHeaders; import com.azure.containers.containerregistry.implementation.models.ContainerRegistryBlobsUploadChunkHeaders; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.models.UploadBlobResult; -import com.azure.containers.containerregistry.models.UploadManifestOptions; -import com.azure.containers.containerregistry.models.UploadManifestResult; +import com.azure.containers.containerregistry.models.UploadRegistryBlobResult; +import com.azure.containers.containerregistry.models.SetManifestOptions; +import com.azure.containers.containerregistry.models.SetManifestResult; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceClient; import com.azure.core.annotation.ServiceMethod; @@ -45,21 +45,20 @@ import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; import java.security.MessageDigest; -import java.util.Collection; import java.util.Objects; import java.util.function.Function; import static com.azure.containers.containerregistry.implementation.UtilsImpl.CHUNK_SIZE; import static com.azure.containers.containerregistry.implementation.UtilsImpl.DOWNLOAD_BLOB_SPAN_NAME; +import static com.azure.containers.containerregistry.implementation.UtilsImpl.SUPPORTED_MANIFEST_TYPES; import static com.azure.containers.containerregistry.implementation.UtilsImpl.UPLOAD_BLOB_SPAN_NAME; import static com.azure.containers.containerregistry.implementation.UtilsImpl.computeDigest; import static com.azure.containers.containerregistry.implementation.UtilsImpl.createSha256; import static com.azure.containers.containerregistry.implementation.UtilsImpl.deleteResponseToSuccess; import static com.azure.containers.containerregistry.implementation.UtilsImpl.getBlobSize; -import static com.azure.containers.containerregistry.implementation.UtilsImpl.getContentTypeString; import static com.azure.containers.containerregistry.implementation.UtilsImpl.getLocation; import static com.azure.containers.containerregistry.implementation.UtilsImpl.mapAcrErrorsException; -import static com.azure.containers.containerregistry.implementation.UtilsImpl.toDownloadManifestResponse; +import static com.azure.containers.containerregistry.implementation.UtilsImpl.toGetManifestResponse; import static com.azure.containers.containerregistry.implementation.UtilsImpl.validateDigest; import static com.azure.containers.containerregistry.implementation.UtilsImpl.validateResponseHeaderDigest; import static com.azure.core.util.CoreUtils.bytesToHexString; @@ -68,13 +67,13 @@ * This class provides a client that exposes operations to push and pull images into container registry. * It exposes methods that upload, download and delete artifacts from the registry i.e. images and manifests. * - *

View {@link ContainerRegistryBlobClientBuilder this} for additional ways to construct the client.

+ *

View {@link ContainerRegistryContentClientBuilder this} for additional ways to construct the client.

* - * @see ContainerRegistryBlobClientBuilder + * @see ContainerRegistryContentClientBuilder */ -@ServiceClient(builder = ContainerRegistryBlobClientBuilder.class) -public final class ContainerRegistryBlobClient { - private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryBlobClient.class); +@ServiceClient(builder = ContainerRegistryContentClientBuilder.class) +public final class ContainerRegistryContentClient { + private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryContentClient.class); private final ContainerRegistryBlobsImpl blobsImpl; private final ContainerRegistriesImpl registriesImpl; @@ -82,7 +81,7 @@ public final class ContainerRegistryBlobClient { private final String repositoryName; private final Tracer tracer; - ContainerRegistryBlobClient(String repositoryName, HttpPipeline httpPipeline, String endpoint, String version, Tracer tracer) { + ContainerRegistryContentClient(String repositoryName, HttpPipeline httpPipeline, String endpoint, String version, Tracer tracer) { this.repositoryName = repositoryName; this.endpoint = endpoint; AzureContainerRegistryImpl registryImplClient = new AzureContainerRegistryImpl(httpPipeline, endpoint, version); @@ -114,11 +113,11 @@ public String getEndpoint() { * *

Code Samples:

* - * + * *
-     * blobClient.uploadManifest(manifest, "v1");
+     * contentClient.setManifest(manifest, "v1");
      * 
- * + * * * @see Oci Manifest Specification * @@ -129,9 +128,9 @@ public String getEndpoint() { * @throws NullPointerException thrown if the {@code manifest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public UploadManifestResult uploadManifest(OciImageManifest manifest, String tag) { + public SetManifestResult setManifest(OciImageManifest manifest, String tag) { Objects.requireNonNull(manifest, "'manifest' cannot be null."); - return uploadManifestWithResponse(BinaryData.fromObject(manifest), tag, ManifestMediaType.OCI_MANIFEST, Context.NONE).getValue(); + return setManifestWithResponse(BinaryData.fromObject(manifest), tag, ManifestMediaType.OCI_MANIFEST, Context.NONE).getValue(); } /** @@ -141,9 +140,9 @@ public UploadManifestResult uploadManifest(OciImageManifest manifest, String tag * * *
-     * UploadManifestOptions options = new UploadManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE);
+     * SetManifestOptions options = new SetManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE);
      *
-     * Response<UploadManifestResult> response = blobClient.uploadManifestWithResponse(options, Context.NONE);
+     * Response<SetManifestResult> response = contentClient.setManifestWithResponse(options, Context.NONE);
      * System.out.println("Manifest uploaded, digest - " + response.getValue().getDigest());
      * 
* @@ -155,15 +154,15 @@ public UploadManifestResult uploadManifest(OciImageManifest manifest, String tag * @throws NullPointerException thrown if the {@code data} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response uploadManifestWithResponse(UploadManifestOptions options, Context context) { + public Response setManifestWithResponse(SetManifestOptions options, Context context) { Objects.requireNonNull(options, "'options' cannot be null."); - return uploadManifestWithResponse(options.getManifest(), options.getTag(), options.getMediaType(), context); + return setManifestWithResponse(options.getManifest(), options.getTag(), options.getManifestMediaType(), context); } /** * Uploads a blob to the repository in chunks of 4MB. * Use this method to upload relatively small content that fits into memory. For large content use - * {@link ContainerRegistryBlobClient#uploadBlob(ReadableByteChannel, Context)} overload. + * {@link ContainerRegistryContentClient#uploadBlob(ReadableByteChannel, Context)} overload. * *

Code Samples

* @@ -171,20 +170,20 @@ public Response uploadManifestWithResponse(UploadManifestO *
      * BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world"));
      *
-     * UploadBlobResult uploadResult = blobClient.uploadBlob(configContent);
+     * UploadRegistryBlobResult uploadResult = contentClient.uploadBlob(configContent);
      * System.out.printf("Uploaded blob: digest - '%s', size - %s\n", uploadResult.getDigest(), uploadResult.getSizeInBytes());
      * 
* * - * @param data The blob content. The content may be loaded into memory depending on how {@link BinaryData} is created. + * @param content The blob content. The content may be loaded into memory depending on how {@link BinaryData} is created. * @return The upload response. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. * @throws NullPointerException thrown if the {@code data} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public UploadBlobResult uploadBlob(BinaryData data) { - Objects.requireNonNull(data, "'data' cannot be null."); - InputStream stream = data.toStream(); + public UploadRegistryBlobResult uploadBlob(BinaryData content) { + Objects.requireNonNull(content, "'content' cannot be null."); + InputStream stream = content.toStream(); try { return uploadBlob(Channels.newChannel(stream), Context.NONE); } finally { @@ -204,23 +203,23 @@ public UploadBlobResult uploadBlob(BinaryData data) { * *
      * try (FileInputStream content = new FileInputStream("artifact.tar.gz")) {
-     *     UploadBlobResult uploadResult = blobClient.uploadBlob(content.getChannel(), Context.NONE);
+     *     UploadRegistryBlobResult uploadResult = contentClient.uploadBlob(content.getChannel(), Context.NONE);
      *     System.out.printf("Uploaded blob: digest - '%s', size - %s\n",
      *         uploadResult.getDigest(), uploadResult.getSizeInBytes());
      * }
      * 
* * - * @param stream The blob content. + * @param content The blob content. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The upload response. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. * @throws NullPointerException thrown if the {@code stream} is {@code null}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public UploadBlobResult uploadBlob(ReadableByteChannel stream, Context context) { - Objects.requireNonNull(stream, "'stream' cannot be null."); - return runWithTracing(UPLOAD_BLOB_SPAN_NAME, (span) -> uploadBlobInternal(stream, span), context); + public UploadRegistryBlobResult uploadBlob(ReadableByteChannel content, Context context) { + Objects.requireNonNull(content, "'content' cannot be null."); + return runWithTracing(UPLOAD_BLOB_SPAN_NAME, (span) -> uploadBlobInternal(content, span), context); } /** @@ -230,26 +229,26 @@ public UploadBlobResult uploadBlob(ReadableByteChannel stream, Context context) * * Download manifest with tag: * - * + * *
-     * DownloadManifestResult latestResult = blobClient.downloadManifest("latest");
-     * if (ManifestMediaType.DOCKER_MANIFEST.equals(latestResult.getMediaType())
-     *     || ManifestMediaType.OCI_MANIFEST.equals(latestResult.getMediaType())) {
-     *     OciImageManifest manifest = latestResult.asOciManifest();
+     * GetManifestResult latestResult = contentClient.getManifest("latest");
+     * if (ManifestMediaType.DOCKER_MANIFEST.equals(latestResult.getManifestMediaType())
+     *     || ManifestMediaType.OCI_MANIFEST.equals(latestResult.getManifestMediaType())) {
+     *     OciImageManifest manifest = latestResult.getManifest().toObject(OciImageManifest.class);
      * } else {
-     *     throw new IllegalArgumentException("Unexpected manifest type: " + latestResult.getMediaType());
+     *     throw new IllegalArgumentException("Unexpected manifest type: " + latestResult.getManifestMediaType());
      * }
      * 
- * + * * * Download manifest with digest: * - * + * *
-     * DownloadManifestResult digestResult = blobClient.downloadManifest(
+     * GetManifestResult getManifestResult = contentClient.getManifest(
      *     "sha256:6581596932dc735fd0df8cc240e6c28845a66829126da5ce25b983cf244e2311");
      * 
- * + * * * @param tagOrDigest Manifest tag or digest. * @return The manifest identified by the given tag or digest. @@ -257,8 +256,8 @@ public UploadBlobResult uploadBlob(ReadableByteChannel stream, Context context) * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DownloadManifestResult downloadManifest(String tagOrDigest) { - return downloadManifestWithResponse(tagOrDigest, null, Context.NONE).getValue(); + public GetManifestResult getManifest(String tagOrDigest) { + return getManifestWithResponse(tagOrDigest, Context.NONE).getValue(); } /** @@ -266,47 +265,29 @@ public DownloadManifestResult downloadManifest(String tagOrDigest) { * *

Code Samples:

* - * + * *
-     * ManifestMediaType dockerListType = ManifestMediaType
-     *     .fromString("application/vnd.docker.distribution.manifest.list.v2+json");
-     * ManifestMediaType ociIndexType = ManifestMediaType
-     *     .fromString("application/vnd.oci.image.index.v1+json");
-     *
-     * Response<DownloadManifestResult> response = blobClient.downloadManifestWithResponse(
-     *     "latest",
-     *     Arrays.asList(dockerListType, ociIndexType),
+     * Response<GetManifestResult> downloadResponse = contentClient.getManifestWithResponse("latest",
      *     Context.NONE);
-     * if (dockerListType.equals(response.getValue().getMediaType())) {
-     *     // DockerManifestList manifestList = downloadResult.getValue().getContent().toObject(DockerManifestList.class);
-     *     System.out.println("Got docker manifest list");
-     * } else if (ociIndexType.equals(response.getValue().getMediaType())) {
-     *     // OciIndex ociIndex = downloadResult.getValue().getContent().toObject(OciIndex.class);
-     *     System.out.println("Got OCI index");
-     * } else {
-     *     throw new IllegalArgumentException("Got unexpected manifest type: " + response.getValue().getMediaType());
-     * }
+     * System.out.printf("Received manifest: digest - %s, response code: %s\n", downloadResponse.getValue().getDigest(),
+     *     downloadResponse.getStatusCode());
      * 
- * + * * * @param tagOrDigest Manifest reference which can be tag or digest. - * @param mediaTypes List of {@link ManifestMediaType} to request. * @param context Additional context that is passed through the Http pipeline during the service call. * @return The response for the manifest identified by the given tag or digest. * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. * @throws NullPointerException thrown if the {@code tagOrDigest} is null. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response downloadManifestWithResponse(String tagOrDigest, Collection mediaTypes, Context context) { + public Response getManifestWithResponse(String tagOrDigest, Context context) { Objects.requireNonNull(tagOrDigest, "'tagOrDigest' cannot be null."); - String requestMediaTypes = getContentTypeString(mediaTypes); - try { Response response = - registriesImpl.getManifestWithResponse(repositoryName, tagOrDigest, - requestMediaTypes, context); - return toDownloadManifestResponse(tagOrDigest, response); + registriesImpl.getManifestWithResponse(repositoryName, tagOrDigest, SUPPORTED_MANIFEST_TYPES, context); + return toGetManifestResponse(tagOrDigest, response); } catch (AcrErrorsException exception) { throw LOGGER.logExceptionAsError(mapAcrErrorsException(exception)); } @@ -321,7 +302,7 @@ public Response downloadManifestWithResponse(String tagO *
      * Path file = Files.createTempFile(digest, ".tmp");
      * SeekableByteChannel channel = Files.newByteChannel(file, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE);
-     * blobClient.downloadStream(digest, channel);
+     * contentClient.downloadStream(digest, channel);
      * 
* * @@ -342,16 +323,14 @@ public void downloadStream(String digest, WritableByteChannel channel) { * @param digest The digest for the given image layer. * @param channel The channel to write content to. * @param context Additional context that is passed through the Http pipeline during the service call. + * * @throws ClientAuthenticationException thrown if the client's credentials do not have access to modify the namespace. * @throws NullPointerException thrown if the {@code digest} is null. * @throws ServiceResponseException thrown if content hash does not match requested digest. */ @ServiceMethod(returns = ReturnType.SINGLE) public void downloadStream(String digest, WritableByteChannel channel, Context context) { - runWithTracing(DOWNLOAD_BLOB_SPAN_NAME, (span) -> { - downloadBlobInternal(digest, channel, span); - return null; - }, context); + runWithTracing(DOWNLOAD_BLOB_SPAN_NAME, (span) -> downloadBlobInternal(digest, channel, span), context); } /** @@ -361,11 +340,11 @@ public void downloadStream(String digest, WritableByteChannel channel, Context c * * *
-     * DownloadManifestResult manifestResult = blobClient.downloadManifest("latest");
+     * GetManifestResult manifestResult = contentClient.getManifest("latest");
      *
-     * OciImageManifest manifest = manifestResult.asOciManifest();
+     * OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class);
      * for (OciDescriptor layer : manifest.getLayers()) {
-     *     blobClient.deleteBlob(layer.getDigest());
+     *     contentClient.deleteBlob(layer.getDigest());
      * }
      * 
* @@ -414,8 +393,8 @@ public Response deleteBlobWithResponse(String digest, Context context) { * * *
-     * DownloadManifestResult manifestResult = blobClient.downloadManifest("latest");
-     * blobClient.deleteManifest(manifestResult.getDigest());
+     * GetManifestResult manifestResult = contentClient.getManifest("latest");
+     * contentClient.deleteManifest(manifestResult.getDigest());
      * 
* * @@ -447,7 +426,7 @@ public Response deleteManifestWithResponse(String digest, Context context) } } - private UploadBlobResult uploadBlobInternal(ReadableByteChannel stream, Context context) { + private UploadRegistryBlobResult uploadBlobInternal(ReadableByteChannel stream, Context context) { MessageDigest sha256 = createSha256(); byte[] buffer = new byte[CHUNK_SIZE]; @@ -479,7 +458,7 @@ private UploadBlobResult uploadBlobInternal(ReadableByteChannel stream, Context ResponseBase completeUploadResponse = blobsImpl.completeUploadWithResponse(digest, location, chunk, chunk == null ? null : chunk.getLength(), context); - return ConstructorAccessors.createUploadBlobResult(completeUploadResponse.getDeserializedHeaders().getDockerContentDigest(), streamLength); + return ConstructorAccessors.createUploadRegistryBlobResult(completeUploadResponse.getDeserializedHeaders().getDockerContentDigest(), streamLength); } catch (AcrErrorsException ex) { throw LOGGER.logExceptionAsError(mapAcrErrorsException(ex)); } @@ -505,7 +484,7 @@ private BinaryData readChunk(ReadableByteChannel stream, MessageDigest sha256, b return BinaryData.fromByteBuffer(byteBuffer); } - private Response uploadManifestWithResponse(BinaryData manifestData, String tagOrDigest, ManifestMediaType manifestMediaType, Context context) { + private Response setManifestWithResponse(BinaryData manifestData, String tagOrDigest, ManifestMediaType manifestMediaType, Context context) { BinaryData data = manifestData.toReplayableBinaryData(); if (tagOrDigest == null) { tagOrDigest = computeDigest(data.toByteBuffer()); @@ -520,23 +499,23 @@ private Response uploadManifestWithResponse(BinaryData man response.getRequest(), response.getStatusCode(), response.getHeaders(), - ConstructorAccessors.createUploadManifestResult(response.getDeserializedHeaders().getDockerContentDigest()), + ConstructorAccessors.createSetManifestResult(response.getDeserializedHeaders().getDockerContentDigest()), response.getDeserializedHeaders()); } catch (AcrErrorsException exception) { throw LOGGER.logExceptionAsError(mapAcrErrorsException(exception)); } } - private void downloadBlobInternal(String digest, WritableByteChannel channel, Context context) { + private Context downloadBlobInternal(String digest, WritableByteChannel channel, Context context) { Objects.requireNonNull(digest, "'digest' cannot be null."); MessageDigest sha256 = createSha256(); try { - Response firstChunk = readRange(digest, new HttpRange(0, (long) CHUNK_SIZE), channel, sha256, context); - validateResponseHeaderDigest(digest, firstChunk.getHeaders()); + Response lastChunk = readRange(digest, new HttpRange(0, (long) CHUNK_SIZE), channel, sha256, context); + validateResponseHeaderDigest(digest, lastChunk.getHeaders()); - long blobSize = getBlobSize(firstChunk.getHeaders().get(HttpHeaderName.CONTENT_RANGE)); - for (long p = firstChunk.getValue().getLength(); p < blobSize; p += CHUNK_SIZE) { + long blobSize = getBlobSize(lastChunk.getHeaders().get(HttpHeaderName.CONTENT_RANGE)); + for (long p = lastChunk.getValue().getLength(); p < blobSize; p += CHUNK_SIZE) { readRange(digest, new HttpRange(p, (long) CHUNK_SIZE), channel, sha256, context); } } catch (AcrErrorsException exception) { @@ -544,6 +523,8 @@ private void downloadBlobInternal(String digest, WritableByteChannel channel, Co } validateDigest(sha256, digest); + + return context; } private Response readRange(String digest, HttpRange range, WritableByteChannel channel, MessageDigest sha256, Context context) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobClientBuilder.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java similarity index 78% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobClientBuilder.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java index 5c6b6a88ad94f..461fe18712b5f 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/ContainerRegistryBlobClientBuilder.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/ContainerRegistryContentClientBuilder.java @@ -1,8 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -package com.azure.containers.containerregistry.specialized; +package com.azure.containers.containerregistry; -import com.azure.containers.containerregistry.ContainerRegistryServiceVersion; import com.azure.containers.containerregistry.implementation.UtilsImpl; import com.azure.containers.containerregistry.models.ContainerRegistryAudience; import com.azure.core.annotation.ServiceClientBuilder; @@ -35,15 +34,15 @@ /** * This class provides a fluent builder API to help aid the configuration and instantiation of {@link - * ContainerRegistryBlobClient ContainerRegistryBlobClients} and {@link ContainerRegistryBlobAsyncClient ContainerRegistryBlobAsyncClients}, call {@link + * ContainerRegistryContentClient ContainerRegistryContentClients} and {@link ContainerRegistryContentAsyncClient ContainerRegistryContentAsyncClients}, call {@link * #buildClient() buildClient} and {@link #buildAsyncClient() buildAsyncClient} respectively to construct an instance of * the desired client. * *

Another way to construct the client is using a {@link HttpPipeline}. The pipeline gives the client an * authenticated way to communicate with the service but it doesn't contain the service endpoint. Set the pipeline with * {@link #pipeline(HttpPipeline) this} and set the service endpoint with {@link #endpoint(String) this}. Using a - * pipeline requires additional setup but allows for finer control on how the {@link ContainerRegistryBlobClient} and {@link - * ContainerRegistryBlobAsyncClient} is built.

+ * pipeline requires additional setup but allows for finer control on how the {@link ContainerRegistryContentClient} and {@link + * ContainerRegistryContentAsyncClient} is built.

*

The service does not directly support AAD credentials and as a result the clients internally depend on a policy that converts * the AAD credentials to the Azure Container Registry specific service credentials. In case you use your own pipeline, you * would need to provide implementation for this policy as well. @@ -52,15 +51,15 @@ */ @ServiceClientBuilder( serviceClients = { - ContainerRegistryBlobAsyncClient.class, - ContainerRegistryBlobClient.class + ContainerRegistryContentAsyncClient.class, + ContainerRegistryContentClient.class }) -public final class ContainerRegistryBlobClientBuilder implements - ConfigurationTrait, - EndpointTrait, - HttpTrait, - TokenCredentialTrait { - private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryBlobClientBuilder.class); +public final class ContainerRegistryContentClientBuilder implements + ConfigurationTrait, + EndpointTrait, + HttpTrait, + TokenCredentialTrait { + private static final ClientLogger LOGGER = new ClientLogger(ContainerRegistryContentClientBuilder.class); private final List perCallPolicies = new ArrayList<>(); private final List perRetryPolicies = new ArrayList<>(); @@ -81,11 +80,11 @@ public final class ContainerRegistryBlobClientBuilder implements * Sets the service endpoint for the Azure Container Registry instance. * * @param endpoint The URL of the Container Registry instance. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. * @throws IllegalArgumentException If {@code endpoint} is null or it cannot be parsed into a valid URL. */ @Override - public ContainerRegistryBlobClientBuilder endpoint(String endpoint) { + public ContainerRegistryContentClientBuilder endpoint(String endpoint) { try { new URL(endpoint); } catch (MalformedURLException ex) { @@ -100,9 +99,9 @@ public ContainerRegistryBlobClientBuilder endpoint(String endpoint) { * Sets the repository name for the Azure Container Registry Blob instance. * * @param repositoryName The URL of the Container Registry instance. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ - public ContainerRegistryBlobClientBuilder repository(String repositoryName) { + public ContainerRegistryContentClientBuilder repositoryName(String repositoryName) { this.repositoryName = repositoryName; return this; } @@ -111,9 +110,9 @@ public ContainerRegistryBlobClientBuilder repository(String repositoryName) { * Sets the audience for the Azure Container Registry service. * * @param audience ARM management scope associated with the given registry. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ - public ContainerRegistryBlobClientBuilder audience(ContainerRegistryAudience audience) { + public ContainerRegistryContentClientBuilder audience(ContainerRegistryAudience audience) { this.audience = audience; return this; } @@ -124,10 +123,10 @@ public ContainerRegistryBlobClientBuilder audience(ContainerRegistryAudience aud * documentation for more details on proper usage of the {@link TokenCredential} type. * * @param credential {@link TokenCredential} used to authorize requests sent to the service. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ @Override - public ContainerRegistryBlobClientBuilder credential(TokenCredential credential) { + public ContainerRegistryContentClientBuilder credential(TokenCredential credential) { this.credential = credential; return this; } @@ -143,7 +142,7 @@ public ContainerRegistryBlobClientBuilder credential(TokenCredential credential) * documentation of types that implement this trait to understand the full set of implications.

*

* If {@code pipeline} is set, all settings other than {@link #endpoint(String) endpoint} are ignored - * to build {@link ContainerRegistryBlobClient} or {@link ContainerRegistryBlobAsyncClient}.
+ * to build {@link ContainerRegistryContentClient} or {@link ContainerRegistryContentAsyncClient}.
*

* * This service takes dependency on an internal policy which converts Azure token credentials into Azure Container Registry specific service credentials. @@ -152,10 +151,10 @@ public ContainerRegistryBlobClientBuilder credential(TokenCredential credential) * {For more information please see Azure Container Registry Authentication }. * * @param httpPipeline {@link HttpPipeline} to use for sending service requests and receiving responses. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ @Override - public ContainerRegistryBlobClientBuilder pipeline(HttpPipeline httpPipeline) { + public ContainerRegistryContentClientBuilder pipeline(HttpPipeline httpPipeline) { if (this.httpPipeline != null && httpPipeline == null) { LOGGER.info("HttpPipeline is being set to 'null' when it was previously configured."); } @@ -170,9 +169,9 @@ public ContainerRegistryBlobClientBuilder pipeline(HttpPipeline httpPipeline) { * newer version of the client library may result in moving to a newer service version. * * @param version {@link ContainerRegistryServiceVersion} of the service to be used when making requests. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ - public ContainerRegistryBlobClientBuilder serviceVersion(ContainerRegistryServiceVersion version) { + public ContainerRegistryContentClientBuilder serviceVersion(ContainerRegistryServiceVersion version) { this.version = version; return this; } @@ -188,10 +187,10 @@ public ContainerRegistryBlobClientBuilder serviceVersion(ContainerRegistryServic * documentation of types that implement this trait to understand the full set of implications.

* * @param httpClient The {@link HttpClient} to use for requests. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ @Override - public ContainerRegistryBlobClientBuilder httpClient(HttpClient httpClient) { + public ContainerRegistryContentClientBuilder httpClient(HttpClient httpClient) { if (this.httpClient != null && httpClient == null) { LOGGER.info("HttpClient is being set to 'null' when it was previously configured."); } @@ -215,11 +214,11 @@ public ContainerRegistryBlobClientBuilder httpClient(HttpClient httpClient) { * * @param clientOptions A configured instance of {@link HttpClientOptions}. * - * @return the updated {@link ContainerRegistryBlobClientBuilder} object + * @return the updated {@link ContainerRegistryContentClientBuilder} object * @see HttpClientOptions */ @Override - public ContainerRegistryBlobClientBuilder clientOptions(ClientOptions clientOptions) { + public ContainerRegistryContentClientBuilder clientOptions(ClientOptions clientOptions) { this.clientOptions = clientOptions; return this; } @@ -231,10 +230,10 @@ public ContainerRegistryBlobClientBuilder clientOptions(ClientOptions clientOpti * configuration store}, use {@link Configuration#NONE} to bypass using configuration settings during construction.

* * @param configuration The configuration store to be used. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ @Override - public ContainerRegistryBlobClientBuilder configuration(Configuration configuration) { + public ContainerRegistryContentClientBuilder configuration(Configuration configuration) { this.configuration = configuration; return this; } @@ -252,10 +251,10 @@ public ContainerRegistryBlobClientBuilder configuration(Configuration configurat * * @param httpLogOptions The {@link HttpLogOptions logging configuration} to use when sending and receiving requests * to and from the service. - * @return The updated {@link ContainerRegistryBlobClientBuilder} object. + * @return The updated {@link ContainerRegistryContentClientBuilder} object. */ @Override - public ContainerRegistryBlobClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { + public ContainerRegistryContentClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) { this.httpLogOptions = httpLogOptions; return this; } @@ -264,14 +263,14 @@ public ContainerRegistryBlobClientBuilder httpLogOptions(HttpLogOptions httpLogO * Sets the {@link HttpPipelinePolicy} that is used to retry requests. *

* The default retry policy will be used if not provided {@link #buildAsyncClient()} to - * build {@link ContainerRegistryBlobAsyncClient}. + * build {@link ContainerRegistryContentAsyncClient}. * * @param retryPolicy The {@link HttpPipelinePolicy} that will be used to retry requests. For example, * {@link RetryPolicy} can be used to retry requests. * - * @return The updated ContainerRegistryBlobClientBuilder object. + * @return The updated ContainerRegistryContentClientBuilder object. */ - public ContainerRegistryBlobClientBuilder retryPolicy(RetryPolicy retryPolicy) { + public ContainerRegistryContentClientBuilder retryPolicy(RetryPolicy retryPolicy) { this.retryPolicy = retryPolicy; return this; } @@ -290,10 +289,10 @@ public ContainerRegistryBlobClientBuilder retryPolicy(RetryPolicy retryPolicy) { * * @param retryOptions The {@link RetryOptions} to use for all the requests made through the client. * - * @return The updated ContainerRegistryBlobClientBuilder object. + * @return The updated ContainerRegistryContentClientBuilder object. */ @Override - public ContainerRegistryBlobClientBuilder retryOptions(RetryOptions retryOptions) { + public ContainerRegistryContentClientBuilder retryOptions(RetryOptions retryOptions) { this.retryOptions = retryOptions; return this; } @@ -309,11 +308,11 @@ public ContainerRegistryBlobClientBuilder retryOptions(RetryOptions retryOptions * documentation of types that implement this trait to understand the full set of implications.

* * @param policy A {@link HttpPipelinePolicy pipeline policy}. - * @return The updated ContainerRegistryBlobClientBuilder object. + * @return The updated ContainerRegistryContentClientBuilder object. * @throws NullPointerException If {@code policy} is null. */ @Override - public ContainerRegistryBlobClientBuilder addPolicy(HttpPipelinePolicy policy) { + public ContainerRegistryContentClientBuilder addPolicy(HttpPipelinePolicy policy) { Objects.requireNonNull(policy, "'policy' cannot be null."); if (policy.getPipelinePosition() == HttpPipelinePosition.PER_CALL) { @@ -326,17 +325,17 @@ public ContainerRegistryBlobClientBuilder addPolicy(HttpPipelinePolicy policy) { } /** - * Creates a {@link ContainerRegistryBlobAsyncClient} based on options set in the Builder. Every time {@code - * buildAsyncClient()} is called a new instance of {@link ContainerRegistryBlobAsyncClient} is created. + * Creates a {@link ContainerRegistryContentAsyncClient} based on options set in the Builder. Every time {@code + * buildAsyncClient()} is called a new instance of {@link ContainerRegistryContentAsyncClient} is created. *

* If {@link #pipeline(HttpPipeline)} pipeline} is set, then the {@code pipeline} and {@link #endpoint(String) endpoint} - * are used to create the {@link ContainerRegistryBlobAsyncClient client}. All other builder settings are ignored. + * are used to create the {@link ContainerRegistryContentAsyncClient client}. All other builder settings are ignored. * - * @return A {@link ContainerRegistryBlobAsyncClient} with the options set from the builder. + * @return A {@link ContainerRegistryContentAsyncClient} with the options set from the builder. * @throws NullPointerException If {@code endpoint} is null. * You can set the values by calling {@link #endpoint(String)} and {@link #audience(ContainerRegistryAudience)} respectively. */ - public ContainerRegistryBlobAsyncClient buildAsyncClient() { + public ContainerRegistryContentAsyncClient buildAsyncClient() { Objects.requireNonNull(endpoint, "'endpoint' can't be null"); // Service version @@ -347,22 +346,22 @@ public ContainerRegistryBlobAsyncClient buildAsyncClient() { Tracer tracer = createTracer(clientOptions); HttpPipeline pipeline = getHttpPipeline(tracer); - ContainerRegistryBlobAsyncClient client = new ContainerRegistryBlobAsyncClient(repositoryName, pipeline, endpoint, serviceVersion.getVersion(), tracer); + ContainerRegistryContentAsyncClient client = new ContainerRegistryContentAsyncClient(repositoryName, pipeline, endpoint, serviceVersion.getVersion(), tracer); return client; } /** - * Creates a {@link ContainerRegistryBlobClient} based on options set in the Builder. Every time {@code - * buildAsyncClient()} is called a new instance of {@link ContainerRegistryBlobClient} is created. + * Creates a {@link ContainerRegistryContentClient} based on options set in the Builder. Every time {@code + * buildAsyncClient()} is called a new instance of {@link ContainerRegistryContentClient} is created. *

* If {@link #pipeline(HttpPipeline)} pipeline} is set, then the {@code pipeline} and {@link #endpoint(String) endpoint} - * are used to create the {@link ContainerRegistryBlobClient client}. All other builder settings are ignored. + * are used to create the {@link ContainerRegistryContentClient client}. All other builder settings are ignored. * - * @return A {@link ContainerRegistryBlobClient} with the options set from the builder. + * @return A {@link ContainerRegistryContentClient} with the options set from the builder. * @throws NullPointerException If {@code endpoint} or {@code audience} is null. * You can set the values by calling {@link #endpoint(String)} and {@link #audience(ContainerRegistryAudience)} respectively. */ - public ContainerRegistryBlobClient buildClient() { + public ContainerRegistryContentClient buildClient() { Objects.requireNonNull(endpoint, "'endpoint' can't be null"); // Service version @@ -371,7 +370,7 @@ public ContainerRegistryBlobClient buildClient() { : ContainerRegistryServiceVersion.getLatest(); Tracer tracer = createTracer(clientOptions); - return new ContainerRegistryBlobClient(repositoryName, getHttpPipeline(tracer), endpoint, serviceVersion.getVersion(), tracer); + return new ContainerRegistryContentClient(repositoryName, getHttpPipeline(tracer), endpoint, serviceVersion.getVersion(), tracer); } private HttpPipeline getHttpPipeline(Tracer tracer) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/AuthenticationsImpl.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/AuthenticationsImpl.java index c646fa4de2c96..8fb7a65ed2a7c 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/AuthenticationsImpl.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/AuthenticationsImpl.java @@ -11,7 +11,6 @@ import com.azure.containers.containerregistry.implementation.models.TokenGrantType; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.FormParam; -import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; @@ -110,26 +109,6 @@ Response exchangeAcrRefreshTokenForAcrAccessTokenSync( @FormParam("grant_type") TokenGrantType grantType, @HeaderParam("Accept") String accept, Context context); - - @Get("/oauth2/token") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(AcrErrorsException.class) - Mono> getAcrAccessTokenFromLogin( - @HostParam("url") String url, - @QueryParam("service") String service, - @QueryParam("scope") String scope, - @HeaderParam("Accept") String accept, - Context context); - - @Get("/oauth2/token") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(AcrErrorsException.class) - Response getAcrAccessTokenFromLoginSync( - @HostParam("url") String url, - @QueryParam("service") String service, - @QueryParam("scope") String scope, - @HeaderParam("Accept") String accept, - Context context); } /** @@ -464,113 +443,4 @@ public AcrAccessToken exchangeAcrRefreshTokenForAcrAccessToken( serviceParam, scope, refreshToken, grantType, Context.NONE) .getValue(); } - - /** - * Exchange Username, Password and Scope for an ACR Access Token. - * - * @param serviceParam Indicates the name of your Azure container registry. - * @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You - * can obtain this from the Www-Authenticate response header from the challenge. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws AcrErrorsException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAcrAccessTokenFromLoginWithResponseAsync( - String serviceParam, String scope) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> - service.getAcrAccessTokenFromLogin(this.client.getUrl(), serviceParam, scope, accept, context)); - } - - /** - * Exchange Username, Password and Scope for an ACR Access Token. - * - * @param serviceParam Indicates the name of your Azure container registry. - * @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You - * can obtain this from the Www-Authenticate response header from the challenge. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws AcrErrorsException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAcrAccessTokenFromLoginWithResponseAsync( - String serviceParam, String scope, Context context) { - final String accept = "application/json"; - return service.getAcrAccessTokenFromLogin(this.client.getUrl(), serviceParam, scope, accept, context); - } - - /** - * Exchange Username, Password and Scope for an ACR Access Token. - * - * @param serviceParam Indicates the name of your Azure container registry. - * @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You - * can obtain this from the Www-Authenticate response header from the challenge. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws AcrErrorsException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAcrAccessTokenFromLoginAsync(String serviceParam, String scope) { - return getAcrAccessTokenFromLoginWithResponseAsync(serviceParam, scope) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Exchange Username, Password and Scope for an ACR Access Token. - * - * @param serviceParam Indicates the name of your Azure container registry. - * @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You - * can obtain this from the Www-Authenticate response header from the challenge. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws AcrErrorsException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Mono getAcrAccessTokenFromLoginAsync(String serviceParam, String scope, Context context) { - return getAcrAccessTokenFromLoginWithResponseAsync(serviceParam, scope, context) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Exchange Username, Password and Scope for an ACR Access Token. - * - * @param serviceParam Indicates the name of your Azure container registry. - * @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You - * can obtain this from the Www-Authenticate response header from the challenge. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws AcrErrorsException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the response body along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAcrAccessTokenFromLoginWithResponse( - String serviceParam, String scope, Context context) { - final String accept = "application/json"; - return service.getAcrAccessTokenFromLoginSync(this.client.getUrl(), serviceParam, scope, accept, context); - } - - /** - * Exchange Username, Password and Scope for an ACR Access Token. - * - * @param serviceParam Indicates the name of your Azure container registry. - * @param scope Expected to be a valid scope, and can be specified more than once for multiple scope requests. You - * can obtain this from the Www-Authenticate response header from the challenge. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws AcrErrorsException 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 AcrAccessToken getAcrAccessTokenFromLogin(String serviceParam, String scope) { - return getAcrAccessTokenFromLoginWithResponse(serviceParam, scope, Context.NONE).getValue(); - } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ConstructorAccessors.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ConstructorAccessors.java index 3b628eaeb5fc3..4353381373802 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ConstructorAccessors.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/ConstructorAccessors.java @@ -4,87 +4,62 @@ package com.azure.containers.containerregistry.implementation; -import com.azure.containers.containerregistry.models.DownloadBlobAsyncResult; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; +import com.azure.containers.containerregistry.models.UploadRegistryBlobResult; +import com.azure.containers.containerregistry.models.SetManifestResult; import com.azure.core.util.BinaryData; -import com.azure.containers.containerregistry.models.UploadBlobResult; -import com.azure.containers.containerregistry.models.UploadManifestResult; import com.azure.core.util.logging.ClientLogger; -import reactor.core.publisher.Flux; - -import java.nio.ByteBuffer; public final class ConstructorAccessors { private static final ClientLogger LOGGER = new ClientLogger(ConstructorAccessors.class); - private static DownloadBlobAsyncResultConstructorAccessor downloadBlobAccessor; - private static DownloadManifestResultConstructorAccessor downloadManifestAccessor; - - private static UploadBlobResultConstructorAccessor uploadBlobResultAccessor; - private static UploadManifestResultConstructorAccessor uploadManifestResultAccessor; - public interface DownloadBlobAsyncResultConstructorAccessor { - DownloadBlobAsyncResult create(String digest, Flux content); - } + private static GetManifestResultConstructorAccessor getManifestAccessor; - public interface DownloadManifestResultConstructorAccessor { - DownloadManifestResult create(String digest, ManifestMediaType mediaType, BinaryData rawData); - } + private static UploadRegistryBlobResultConstructorAccessor uploadBlobResultAccessor; + private static SetManifestResultConstructorAccessor setManifestResultAccessor; - public interface UploadManifestResultConstructorAccessor { - UploadManifestResult create(String digest); + public interface GetManifestResultConstructorAccessor { + GetManifestResult create(String digest, ManifestMediaType mediaType, BinaryData rawData); } - public interface UploadBlobResultConstructorAccessor { - UploadBlobResult create(String digest, long length); + public interface SetManifestResultConstructorAccessor { + SetManifestResult create(String digest); } - public static void setDownloadBlobResultAccessor(final DownloadBlobAsyncResultConstructorAccessor accessor) { - downloadBlobAccessor = accessor; + public interface UploadRegistryBlobResultConstructorAccessor { + UploadRegistryBlobResult create(String digest, long length); } - public static void setDownloadManifestResultAccessor(final DownloadManifestResultConstructorAccessor accessor) { - downloadManifestAccessor = accessor; + public static void setGetManifestResultAccessor(final GetManifestResultConstructorAccessor accessor) { + getManifestAccessor = accessor; } - public static void setUploadBlobResultAccessor(final UploadBlobResultConstructorAccessor accessor) { + public static void setUploadRegistryBlobResultAccessor(final UploadRegistryBlobResultConstructorAccessor accessor) { uploadBlobResultAccessor = accessor; } - public static void setUploadManifestResultAccessor(final UploadManifestResultConstructorAccessor accessor) { - uploadManifestResultAccessor = accessor; - } - - public static DownloadBlobAsyncResult createDownloadBlobResult(String digest, Flux content) { - if (downloadBlobAccessor == null) { - try { - // it's possible that nobody yet created BlobDownloadAsyncResult, so we'll need to force its static section to run and set accessor. - Class.forName(DownloadBlobAsyncResult.class.getName(), true, DownloadBlobAsyncResultConstructorAccessor.class.getClassLoader()); - } catch (ClassNotFoundException e) { - throw LOGGER.logExceptionAsError(new RuntimeException(e)); - } - } - assert downloadBlobAccessor != null; - return downloadBlobAccessor.create(digest, content); + public static void setSetManifestResultAccessor(final SetManifestResultConstructorAccessor accessor) { + setManifestResultAccessor = accessor; } - public static DownloadManifestResult createDownloadManifestResult(String digest, ManifestMediaType mediaType, BinaryData rawData) { - if (downloadManifestAccessor == null) { + public static GetManifestResult createGetManifestResult(String digest, ManifestMediaType mediaType, BinaryData rawData) { + if (getManifestAccessor == null) { try { // it's possible that nobody yet created DownloadBlobAsyncResult, so we'll need to force its static section to run and set accessor. - Class.forName(DownloadManifestResult.class.getName(), true, DownloadManifestResultConstructorAccessor.class.getClassLoader()); + Class.forName(GetManifestResult.class.getName(), true, GetManifestResultConstructorAccessor.class.getClassLoader()); } catch (ClassNotFoundException e) { throw LOGGER.logExceptionAsError(new RuntimeException(e)); } } - assert downloadManifestAccessor != null; - return downloadManifestAccessor.create(digest, mediaType, rawData); + assert getManifestAccessor != null; + return getManifestAccessor.create(digest, mediaType, rawData); } - public static UploadBlobResult createUploadBlobResult(String digest, long length) { + public static UploadRegistryBlobResult createUploadRegistryBlobResult(String digest, long length) { if (uploadBlobResultAccessor == null) { try { // it's possible that nobody yet created BlobDownloadAsyncResult, so we'll need to force its static section to run and set accessor. - Class.forName(UploadBlobResult.class.getName(), true, UploadBlobResultConstructorAccessor.class.getClassLoader()); + Class.forName(UploadRegistryBlobResult.class.getName(), true, UploadRegistryBlobResultConstructorAccessor.class.getClassLoader()); } catch (ClassNotFoundException e) { throw LOGGER.logExceptionAsError(new RuntimeException(e)); } @@ -93,16 +68,16 @@ public static UploadBlobResult createUploadBlobResult(String digest, long length return uploadBlobResultAccessor.create(digest, length); } - public static UploadManifestResult createUploadManifestResult(String digest) { - if (uploadManifestResultAccessor == null) { + public static SetManifestResult createSetManifestResult(String digest) { + if (setManifestResultAccessor == null) { try { // it's possible that nobody yet created BlobDownloadAsyncResult, so we'll need to force its static section to run and set accessor. - Class.forName(UploadManifestResult.class.getName(), true, UploadManifestResultConstructorAccessor.class.getClassLoader()); + Class.forName(SetManifestResult.class.getName(), true, SetManifestResultConstructorAccessor.class.getClassLoader()); } catch (ClassNotFoundException e) { throw LOGGER.logExceptionAsError(new RuntimeException(e)); } } - assert uploadManifestResultAccessor != null; - return uploadManifestResultAccessor.create(digest); + assert setManifestResultAccessor != null; + return setManifestResultAccessor.create(digest); } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/UtilsImpl.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/UtilsImpl.java index a87251b2d29a3..55c4c87ca79ff 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/UtilsImpl.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/implementation/UtilsImpl.java @@ -13,7 +13,7 @@ import com.azure.containers.containerregistry.models.ArtifactManifestProperties; import com.azure.containers.containerregistry.models.ArtifactTagProperties; import com.azure.containers.containerregistry.models.ContainerRegistryAudience; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.core.credential.TokenCredential; import com.azure.core.exception.ClientAuthenticationException; @@ -60,12 +60,10 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; import static com.azure.core.util.CoreUtils.bytesToHexString; @@ -82,12 +80,18 @@ public final class UtilsImpl { private static final int HTTP_STATUS_CODE_ACCEPTED = 202; public static final HttpHeaderName DOCKER_DIGEST_HEADER_NAME = HttpHeaderName.fromString("docker-content-digest"); - // TODO (limolkova) should we send index and list too so that we won't need to change the default later on? - public static final String SUPPORTED_MANIFEST_TYPES = ManifestMediaType.OCI_MANIFEST + "," + ManifestMediaType.DOCKER_MANIFEST; + + public static final String SUPPORTED_MANIFEST_TYPES = "*/*" + + "," + ManifestMediaType.OCI_MANIFEST + + "," + ManifestMediaType.DOCKER_MANIFEST + + ",application/vnd.oci.image.index.v1+json" + + ",application/vnd.docker.distribution.manifest.list.v2+json" + + ",application/vnd.cncf.oras.artifact.manifest.v1+json"; + private static final String CONTAINER_REGISTRY_TRACING_NAMESPACE_VALUE = "Microsoft.ContainerRegistry"; public static final int CHUNK_SIZE = 4 * 1024 * 1024; - public static final String UPLOAD_BLOB_SPAN_NAME = "ContainerRegistryBlobAsyncClient.uploadBlob"; - public static final String DOWNLOAD_BLOB_SPAN_NAME = "ContainerRegistryBlobAsyncClient.downloadBlob"; + public static final String UPLOAD_BLOB_SPAN_NAME = "ContainerRegistryContentAsyncClient.uploadBlob"; + public static final String DOWNLOAD_BLOB_SPAN_NAME = "ContainerRegistryContentAsyncClient.downloadBlob"; private UtilsImpl() { } @@ -223,7 +227,7 @@ public static void validateDigest(MessageDigest messageDigest, String requestedD } } - public static Response toDownloadManifestResponse(String tagOrDigest, Response rawResponse) { + public static Response toGetManifestResponse(String tagOrDigest, Response rawResponse) { String digest = rawResponse.getHeaders().getValue(DOCKER_DIGEST_HEADER_NAME); String responseSha256 = computeDigest(rawResponse.getValue().toByteBuffer()); @@ -239,7 +243,7 @@ public static Response toDownloadManifestResponse(String rawResponse.getRequest(), rawResponse.getStatusCode(), rawResponse.getHeaders(), - ConstructorAccessors.createDownloadManifestResult(digest, responseMediaType, rawResponse.getValue())); + ConstructorAccessors.createGetManifestResult(digest, responseMediaType, rawResponse.getValue())); } /** @@ -477,12 +481,4 @@ public static String formatFullyQualifiedReference(String endpoint, String repos throw LOGGER.logExceptionAsWarning(new IllegalArgumentException("'endpoint' must be a valid URL", ex)); } } - - public static String getContentTypeString(Collection mediaTypes) { - return CoreUtils.isNullOrEmpty(mediaTypes) - ? SUPPORTED_MANIFEST_TYPES - : mediaTypes.stream() - .map(String::valueOf) - .collect(Collectors.joining(",")); - } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/DownloadBlobAsyncResult.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/DownloadBlobAsyncResult.java deleted file mode 100644 index bdaa364a9548d..0000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/DownloadBlobAsyncResult.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -package com.azure.containers.containerregistry.models; - -import com.azure.containers.containerregistry.implementation.ConstructorAccessors; -import com.azure.containers.containerregistry.implementation.UtilsImpl; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.FluxUtil; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -import java.io.UncheckedIOException; -import java.nio.ByteBuffer; -import java.nio.channels.AsynchronousByteChannel; -import java.nio.channels.WritableByteChannel; -import java.security.MessageDigest; -import java.util.Objects; - -import static com.azure.containers.containerregistry.implementation.UtilsImpl.validateDigest; - -/** - * The object returned by the downloadBlob operation - * containing the blob contents and its digest. - */ -@Fluent -public final class DownloadBlobAsyncResult { - static { - ConstructorAccessors.setDownloadBlobResultAccessor(DownloadBlobAsyncResult::new); - } - - private final Flux content; - private final MessageDigest sha256; - - /** - * Initialize an instance of DownloadBlobResult. - * @param digest The requested digest. - * @param content The content of the blob. - */ - private DownloadBlobAsyncResult(String digest, Flux content) { - this.sha256 = UtilsImpl.createSha256(); - this.content = content - .doOnNext(buffer -> sha256.update(buffer.asReadOnlyBuffer())) - .doOnComplete(() -> validateDigest(sha256, digest)) - .doOnError(UtilsImpl::mapException); - } - - /** - * Get the blob contents. - * @return The contents of the blob. - */ - public Flux getValue() { - return content; - } - - /** - * Transfers content bytes to the {@link AsynchronousByteChannel}. - * @param channel The destination {@link AsynchronousByteChannel}. - * @return A {@link Mono} that completes when transfer is completed. - */ - public Mono writeValueToAsync(AsynchronousByteChannel channel) { - Objects.requireNonNull(channel, "'channel' must not be null"); - return FluxUtil.writeToAsynchronousByteChannel(content, channel); - } - - /** - * Transfers content bytes to the {@link WritableByteChannel}. - * @param channel The destination {@link WritableByteChannel}. - * @return A {@link Mono} that completes when transfer is completed. - * @throws UncheckedIOException When I/O operation fails. - */ - public Mono writeValueTo(WritableByteChannel channel) { - Objects.requireNonNull(channel, "'channel' must not be null"); - return FluxUtil.writeToWritableByteChannel(content, channel); - } -} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/DownloadManifestResult.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/DownloadManifestResult.java deleted file mode 100644 index 5b4900c357aea..0000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/DownloadManifestResult.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -package com.azure.containers.containerregistry.models; - -import com.azure.containers.containerregistry.implementation.ConstructorAccessors; -import com.azure.core.util.BinaryData; -import com.azure.core.util.logging.ClientLogger; - -/** - * The result from downloading an OCI manifest from the registry. - */ -public class DownloadManifestResult { - private static final ClientLogger LOGGER = new ClientLogger(DownloadManifestResult.class); - static { - ConstructorAccessors.setDownloadManifestResultAccessor(DownloadManifestResult::new); - } - - private final String digest; - private OciImageManifest ociManifest; - private final ManifestMediaType mediaType; - private final BinaryData rawData; - - DownloadManifestResult(String digest, ManifestMediaType mediaType, BinaryData rawData) { - this.digest = digest; - this.mediaType = mediaType; - this.rawData = rawData; - } - - /** - * The manifest's digest, calculated by the registry. - * @return The digest. - */ - public String getDigest() { - return this.digest; - } - - /** - * The OCI manifest that was downloaded. - * @return The {@link OciImageManifest} instance. - * @throws IllegalStateException thrown when attempting to get {@link OciImageManifest} from incompatible media type. - */ - public OciImageManifest asOciManifest() { - if (ociManifest != null) { - return ociManifest; - } - - if (!ManifestMediaType.DOCKER_MANIFEST.equals(mediaType) - && !ManifestMediaType.OCI_MANIFEST.equals(mediaType)) { - throw LOGGER.logExceptionAsError(new IllegalStateException( - String.format("Cannot convert manifest with %s media type to OciImageManifest", mediaType))); - } - - ociManifest = rawData.toObject(OciImageManifest.class); - - return ociManifest; - } - - /** - * The manifest stream that was downloaded. - * @return The associated manifest stream. - */ - public BinaryData getContent() { - return this.rawData; - } - - /** - * Get manifest media type. - * @return Instance of {@link ManifestMediaType} - */ - public ManifestMediaType getMediaType() { - return mediaType; - } -} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/GetManifestResult.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/GetManifestResult.java new file mode 100644 index 0000000000000..6a3fc4471d014 --- /dev/null +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/GetManifestResult.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +package com.azure.containers.containerregistry.models; + +import com.azure.containers.containerregistry.implementation.ConstructorAccessors; +import com.azure.core.util.BinaryData; + +/** + * The result of getting a manifest from the registry. + */ +public final class GetManifestResult { + static { + ConstructorAccessors.setGetManifestResultAccessor(GetManifestResult::new); + } + + private final String digest; + private final ManifestMediaType mediaType; + private final BinaryData rawData; + + GetManifestResult(String digest, ManifestMediaType mediaType, BinaryData rawData) { + this.digest = digest; + this.mediaType = mediaType; + this.rawData = rawData; + } + + /** + * The manifest's digest, calculated by the registry. + * @return The digest. + */ + public String getDigest() { + return this.digest; + } + + /** + * The manifest content retrieved from the service. + * @return The associated manifest content. + */ + public BinaryData getManifest() { + return this.rawData; + } + + /** + * Get manifest media type. + * @return Instance of {@link ManifestMediaType} + */ + public ManifestMediaType getManifestMediaType() { + return mediaType; + } +} diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestMediaType.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestMediaType.java index 3eddc79dd7178..4cff5f3df6340 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestMediaType.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/ManifestMediaType.java @@ -8,7 +8,7 @@ /** * Manifest media type. */ -public class ManifestMediaType extends ExpandableStringEnum { +public final class ManifestMediaType extends ExpandableStringEnum { /** * Docker v2 manifest content type. diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciAnnotations.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciAnnotations.java index e806d04db3c18..06ea71e32df20 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciAnnotations.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciAnnotations.java @@ -22,7 +22,7 @@ public final class OciAnnotations implements JsonSerializable { * Date and time on which the image was built (string, date-time as defined by * https://tools.ietf.org/html/rfc3339#section-5.6) */ - private OffsetDateTime created; + private OffsetDateTime createdOn; /* * Contact details of the people or organization responsible for the image. @@ -89,24 +89,24 @@ public final class OciAnnotations implements JsonSerializable { public OciAnnotations() {} /** - * Get the created property: Date and time on which the image was built (string, date-time as defined by + * Get the createdOn property: Date and time on which the image was built (string, date-time as defined by * https://tools.ietf.org/html/rfc3339#section-5.6). * - * @return the created value. + * @return the createdOn value. */ - public OffsetDateTime getCreated() { - return this.created; + public OffsetDateTime getCreatedOn() { + return this.createdOn; } /** - * Set the created property: Date and time on which the image was built (string, date-time as defined by + * Set the createdOn property: Date and time on which the image was built (string, date-time as defined by * https://tools.ietf.org/html/rfc3339#section-5.6). * - * @param created the created value to set. + * @param createdOn the createdOn value to set. * @return the OciAnnotations object itself. */ - public OciAnnotations setCreated(OffsetDateTime created) { - this.created = created; + public OciAnnotations setCreatedOn(OffsetDateTime createdOn) { + this.createdOn = createdOn; return this; } @@ -357,7 +357,7 @@ public OciAnnotations setAdditionalProperties(Map additionalProp @Override public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { jsonWriter.writeStartObject(); - jsonWriter.writeStringField("org.opencontainers.image.created", Objects.toString(this.created, null)); + jsonWriter.writeStringField("org.opencontainers.image.created", Objects.toString(this.createdOn, null)); jsonWriter.writeStringField("org.opencontainers.image.authors", this.authors); jsonWriter.writeStringField("org.opencontainers.image.url", this.url); jsonWriter.writeStringField("org.opencontainers.image.documentation", this.documentation); @@ -395,7 +395,7 @@ public static OciAnnotations fromJson(JsonReader jsonReader) throws IOException reader.nextToken(); if ("org.opencontainers.image.created".equals(fieldName)) { - deserializedOciAnnotations.created = + deserializedOciAnnotations.createdOn = reader.getNullable( nonNullReader -> OffsetDateTime.parse(nonNullReader.getString())); } else if ("org.opencontainers.image.authors".equals(fieldName)) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciImageManifest.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciImageManifest.java index 730b0b377f70a..62ba18f71ac34 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciImageManifest.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/OciImageManifest.java @@ -15,12 +15,10 @@ /** Returns the requested OCI Manifest file. */ @Fluent public final class OciImageManifest implements JsonSerializable { - // TODO (limolkova) should default value be auto-generated? - private static final int DEFAULT_VERSION = 2; /* * V2 image config descriptor */ - private OciDescriptor config; + private OciDescriptor configuration; /* * List of V2 image layer information @@ -35,28 +33,28 @@ public final class OciImageManifest implements JsonSerializable writer.writeJson(element)); jsonWriter.writeJsonField("annotations", this.annotations); return jsonWriter.writeEndObject(); @@ -150,7 +148,7 @@ public static OciImageManifest fromJson(JsonReader jsonReader) throws IOExceptio if ("schemaVersion".equals(fieldName)) { deserializedOciImageManifest.schemaVersion = reader.getInt(); } else if ("config".equals(fieldName)) { - deserializedOciImageManifest.config = OciDescriptor.fromJson(reader); + deserializedOciImageManifest.configuration = OciDescriptor.fromJson(reader); } else if ("layers".equals(fieldName)) { List layers = reader.readArray(reader1 -> OciDescriptor.fromJson(reader1)); deserializedOciImageManifest.layers = layers; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestOptions.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/SetManifestOptions.java similarity index 57% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestOptions.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/SetManifestOptions.java index 1798aa031a13a..bf4a1a10e140a 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestOptions.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/SetManifestOptions.java @@ -8,29 +8,29 @@ import java.util.Objects; /** - * Options for configuring the upload manifest operation. + * Set manifest options. */ -public final class UploadManifestOptions { +public final class SetManifestOptions { private final ManifestMediaType mediaType; private final BinaryData manifest; private String tag; /** - * Instantiate an instance of upload manifest options with the ocimanifest information. - * @param ociManifest The Oci manifest. + * Creates new instance of {@link SetManifestOptions} + * @param ociImageManifest Instance of {@link OciImageManifest} to be set on the service. */ - public UploadManifestOptions(OciImageManifest ociManifest) { - Objects.requireNonNull(ociManifest, "'ociManifest' can't be null."); - this.manifest = BinaryData.fromObject(ociManifest); + public SetManifestOptions(OciImageManifest ociImageManifest) { + Objects.requireNonNull(ociImageManifest, "'ociManifest' can't be null."); + this.manifest = BinaryData.fromObject(ociImageManifest); this.mediaType = ManifestMediaType.OCI_MANIFEST; } /** - * Instantiate an instance of upload manifest options with the manifest information. - * @param manifest The manifest that needs to be uploaded. + * Creates new instance of {@link SetManifestOptions} + * @param manifest The manifest to set. * @param manifestMediaType The media type of supplied manifest. */ - public UploadManifestOptions(BinaryData manifest, ManifestMediaType manifestMediaType) { + public SetManifestOptions(BinaryData manifest, ManifestMediaType manifestMediaType) { Objects.requireNonNull(manifest, "'manifest' can't be null."); Objects.requireNonNull(manifestMediaType, "'manifestMediaType' can't be null."); this.manifest = manifest; @@ -39,10 +39,10 @@ public UploadManifestOptions(BinaryData manifest, ManifestMediaType manifestMedi /** * A tag to assign to the artifact represented by this manifest. - * @param tag The tag of the manifest. - * @return The UploadManifestOptions object. + * @param tag Tag to be set on the manifest when sending it. + * @return The {@link SetManifestOptions} object for chaining. */ - public UploadManifestOptions setTag(String tag) { + public SetManifestOptions setTag(String tag) { this.tag = tag; return this; } @@ -56,8 +56,8 @@ public String getTag() { } /** - * The manifest to be uploaded. - * @return The BinaryData representing the manifest. + * The manifest to be sent to the service. + * @return The {@link BinaryData} representing the manifest. */ public BinaryData getManifest() { return this.manifest; @@ -67,7 +67,7 @@ public BinaryData getManifest() { * Media type of the corresponding manifest. * @return instance of {@link ManifestMediaType}. */ - public ManifestMediaType getMediaType() { + public ManifestMediaType getManifestMediaType() { return mediaType; } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestResult.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/SetManifestResult.java similarity index 51% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestResult.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/SetManifestResult.java index 337b48fd28854..63a5c3c83ec38 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadManifestResult.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/SetManifestResult.java @@ -6,24 +6,20 @@ import com.azure.containers.containerregistry.implementation.ConstructorAccessors; /** - * The result from uploading a manifest. + * The result from setting a manifest. */ -public final class UploadManifestResult { +public final class SetManifestResult { static { - ConstructorAccessors.setUploadManifestResultAccessor(UploadManifestResult::new); + ConstructorAccessors.setSetManifestResultAccessor(SetManifestResult::new); } private final String digest; - /** - * Initializes upload manifest result object. - * @param digest The digest associated with the manifest. - */ - private UploadManifestResult(String digest) { + private SetManifestResult(String digest) { this.digest = digest; } /** - * Get the digest associated with the upload manifest operation. + * Get manifest digest. * @return The digest. */ public String getDigest() { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadBlobResult.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadRegistryBlobResult.java similarity index 81% rename from sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadBlobResult.java rename to sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadRegistryBlobResult.java index 2129c0812ae94..4208f203fb5ce 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadBlobResult.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/models/UploadRegistryBlobResult.java @@ -8,9 +8,9 @@ /** * The result from uploading the blob. */ -public final class UploadBlobResult { +public final class UploadRegistryBlobResult { static { - ConstructorAccessors.setUploadBlobResultAccessor(UploadBlobResult::new); + ConstructorAccessors.setUploadRegistryBlobResultAccessor(UploadRegistryBlobResult::new); } private final String digest; @@ -20,7 +20,7 @@ public final class UploadBlobResult { * Instantiate the upload blob result. * @param digest The digest of the blob that was uploaded. */ - private UploadBlobResult(String digest, long length) { + private UploadRegistryBlobResult(String digest, long length) { this.digest = digest; this.length = length; } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/package-info.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/package-info.java deleted file mode 100644 index 06ed2dd602e7c..0000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/com/azure/containers/containerregistry/specialized/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -// 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 AzureContainerRegistry. Metadata API definition for the Azure Container - * Registry runtime. - */ -package com.azure.containers.containerregistry.specialized; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/module-info.java b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/module-info.java index e2cd151f48a84..10d8b8c170c67 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/main/java/module-info.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/main/java/module-info.java @@ -7,7 +7,6 @@ exports com.azure.containers.containerregistry; exports com.azure.containers.containerregistry.models; - exports com.azure.containers.containerregistry.specialized; opens com.azure.containers.containerregistry.implementation to com.fasterxml.jackson.databind, com.azure.core; opens com.azure.containers.containerregistry.implementation.models to com.fasterxml.jackson.databind, com.azure.core; diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImage.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImage.java index 04efada16465d..47b1b84dc1b91 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImage.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImage.java @@ -3,12 +3,10 @@ package com.azure.containers.containerregistry; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciDescriptor; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.identity.DefaultAzureCredential; @@ -22,7 +20,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; -import java.util.Arrays; public class DownloadImage { private static final String ENDPOINT = "https://registryName.azurecr.io"; @@ -32,24 +29,24 @@ public class DownloadImage { private static final DefaultAzureCredential CREDENTIAL = new DefaultAzureCredentialBuilder().build(); public static void main(String[] args) throws IOException { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); // BEGIN: readme-sample-downloadImage - DownloadManifestResult manifestResult = blobClient.downloadManifest("latest"); + GetManifestResult manifestResult = contentClient.getManifest("latest"); - OciImageManifest manifest = manifestResult.asOciManifest(); + OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class); System.out.printf("Got manifest:\n%s\n", PRETTY_PRINT.writeValueAsString(manifest)); - String configFileName = manifest.getConfig().getDigest() + ".json"; - blobClient.downloadStream(manifest.getConfig().getDigest(), createFileChannel(configFileName)); + String configFileName = manifest.getConfiguration().getDigest() + ".json"; + contentClient.downloadStream(manifest.getConfiguration().getDigest(), createFileChannel(configFileName)); System.out.printf("Got config: %s\n", configFileName); for (OciDescriptor layer : manifest.getLayers()) { - blobClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest())); + contentClient.downloadStream(layer.getDigest(), createFileChannel(layer.getDigest())); System.out.printf("Got layer: %s\n", layer.getDigest()); } // END: readme-sample-downloadImage @@ -77,9 +74,9 @@ private static String getTempDirectory() { } private void downloadStream() throws IOException { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); @@ -88,59 +85,37 @@ private void downloadStream() throws IOException { // BEGIN: com.azure.containers.containerregistry.downloadStream Path file = Files.createTempFile(digest, ".tmp"); SeekableByteChannel channel = Files.newByteChannel(file, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE); - blobClient.downloadStream(digest, channel); + contentClient.downloadStream(digest, channel); // END: com.azure.containers.containerregistry.downloadStream } - private void downloadManifest() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + private void getManifest() { + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); - // BEGIN: com.azure.containers.containerregistry.downloadManifestTag - DownloadManifestResult latestResult = blobClient.downloadManifest("latest"); - if (ManifestMediaType.DOCKER_MANIFEST.equals(latestResult.getMediaType()) - || ManifestMediaType.OCI_MANIFEST.equals(latestResult.getMediaType())) { - OciImageManifest manifest = latestResult.asOciManifest(); + // BEGIN: com.azure.containers.containerregistry.getManifestTag + GetManifestResult latestResult = contentClient.getManifest("latest"); + if (ManifestMediaType.DOCKER_MANIFEST.equals(latestResult.getManifestMediaType()) + || ManifestMediaType.OCI_MANIFEST.equals(latestResult.getManifestMediaType())) { + OciImageManifest manifest = latestResult.getManifest().toObject(OciImageManifest.class); } else { - throw new IllegalArgumentException("Unexpected manifest type: " + latestResult.getMediaType()); + throw new IllegalArgumentException("Unexpected manifest type: " + latestResult.getManifestMediaType()); } - // END: com.azure.containers.containerregistry.downloadManifestTag + // END: com.azure.containers.containerregistry.getManifestTag - // BEGIN: com.azure.containers.containerregistry.downloadManifestDigest - DownloadManifestResult digestResult = blobClient.downloadManifest( + // BEGIN: com.azure.containers.containerregistry.getManifestDigest + GetManifestResult getManifestResult = contentClient.getManifest( "sha256:6581596932dc735fd0df8cc240e6c28845a66829126da5ce25b983cf244e2311"); - // END: com.azure.containers.containerregistry.downloadManifestDigest - } - - private void downloadCustomManifest() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() - .endpoint(ENDPOINT) - .repository(REPOSITORY) - .credential(CREDENTIAL) - .buildClient(); - - // BEGIN: com.azure.containers.containerregistry.downloadCustomManifest - ManifestMediaType dockerListType = ManifestMediaType - .fromString("application/vnd.docker.distribution.manifest.list.v2+json"); - ManifestMediaType ociIndexType = ManifestMediaType - .fromString("application/vnd.oci.image.index.v1+json"); + // END: com.azure.containers.containerregistry.getManifestDigest - Response response = blobClient.downloadManifestWithResponse( - "latest", - Arrays.asList(dockerListType, ociIndexType), + // BEGIN: com.azure.containers.containerregistry.getManifestWithResponse + Response downloadResponse = contentClient.getManifestWithResponse("latest", Context.NONE); - if (dockerListType.equals(response.getValue().getMediaType())) { - // DockerManifestList manifestList = downloadResult.getValue().getContent().toObject(DockerManifestList.class); - System.out.println("Got docker manifest list"); - } else if (ociIndexType.equals(response.getValue().getMediaType())) { - // OciIndex ociIndex = downloadResult.getValue().getContent().toObject(OciIndex.class); - System.out.println("Got OCI index"); - } else { - throw new IllegalArgumentException("Got unexpected manifest type: " + response.getValue().getMediaType()); - } - // END: com.azure.containers.containerregistry.downloadCustomManifest + System.out.printf("Received manifest: digest - %s, response code: %s\n", downloadResponse.getValue().getDigest(), + downloadResponse.getStatusCode()); + // END: com.azure.containers.containerregistry.getManifestWithResponse } } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImageAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImageAsync.java index cc78b52105247..1acbda7e20d35 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImageAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/DownloadImageAsync.java @@ -3,10 +3,10 @@ package com.azure.containers.containerregistry; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; +import com.azure.core.util.FluxUtil; import com.azure.identity.DefaultAzureCredential; import com.azure.identity.DefaultAzureCredentialBuilder; import com.fasterxml.jackson.core.JsonProcessingException; @@ -23,7 +23,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; -import java.util.Arrays; public class DownloadImageAsync { private static final String ENDPOINT = "https://registryName.azurecr.io"; @@ -33,32 +32,32 @@ public class DownloadImageAsync { private static final DefaultAzureCredential CREDENTIAL = new DefaultAzureCredentialBuilder().build(); public static void main(String[] args) { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildAsyncClient(); // BEGIN: readme-sample-downloadImageAsync - blobClient - .downloadManifest("latest") - .map(manifestResult -> manifestResult.asOciManifest()) + contentClient + .getManifest("latest") + .map(manifestResult -> manifestResult.getManifest().toObject(OciImageManifest.class)) .doOnSuccess(manifest -> System.out.printf("Got manifest:\n%s\n", prettyPrint(manifest))) .flatMapMany(manifest -> { - String configFileName = manifest.getConfig().getDigest() + ".json"; + String configFileName = manifest.getConfiguration().getDigest() + ".json"; FileChannel configChannel = createFileChannel(configFileName); - Mono downloadConfig = blobClient - .downloadStream(manifest.getConfig().getDigest()) - .flatMap(downloadResponse -> downloadResponse.writeValueTo(configChannel)) + Mono downloadConfig = contentClient + .downloadStream(manifest.getConfiguration().getDigest()) + .flatMap(downloadResponse -> FluxUtil.writeToWritableByteChannel(downloadResponse.toFluxByteBuffer(), configChannel)) .doOnSuccess(i -> System.out.printf("Got config: %s\n", configFileName)) .doFinally(i -> closeStream(configChannel)); Flux downloadLayers = Flux.fromIterable(manifest.getLayers()) .flatMap(layer -> { FileChannel layerChannel = createFileChannel(layer.getDigest()); - return blobClient.downloadStream(layer.getDigest()) - .flatMap(downloadResponse -> downloadResponse.writeValueTo(layerChannel)) + return contentClient.downloadStream(layer.getDigest()) + .flatMap(downloadResponse -> FluxUtil.writeToWritableByteChannel(downloadResponse.toFluxByteBuffer(), layerChannel)) .doOnSuccess(i -> System.out.printf("Got layer: %s\n", layer.getDigest())) .doFinally(i -> closeStream(layerChannel)); }); @@ -72,31 +71,32 @@ public static void main(String[] args) { } private static void downloadBlob() { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildAsyncClient(); String digest = "sha256:6581596932dc735fd0df8cc240e6c28845a66829126da5ce25b983cf244e2311"; // BEGIN: com.azure.containers.containerregistry.downloadStreamAsyncFile - blobClient + contentClient .downloadStream(digest) .flatMap(downloadResult -> Mono.using(() -> new FileOutputStream(trimSha(digest)), - fileStream -> downloadResult.writeValueTo(fileStream.getChannel()), + fileStream -> FluxUtil.writeToWritableByteChannel( + downloadResult.toFluxByteBuffer(), fileStream.getChannel()), fileStream -> closeStream(fileStream))) .block(); // END: com.azure.containers.containerregistry.downloadStreamAsyncFile // BEGIN: com.azure.containers.containerregistry.downloadStreamAsyncSocket - blobClient + contentClient .downloadStream(digest) .flatMap(downloadResult -> Mono.using( () -> openSocket(), - socket -> downloadResult.writeValueToAsync(socket), + socket -> FluxUtil.writeToAsynchronousByteChannel(downloadResult.toFluxByteBuffer(), socket), socket -> closeStream(socket))) .block(); // END: com.azure.containers.containerregistry.downloadStreamAsyncSocket @@ -116,58 +116,49 @@ private static AsynchronousSocketChannel openSocket() { return null; } - private static void downloadManifest() { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + private static void getManifest() { + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.downloadManifestAsync - blobClient.downloadManifest("latest") + // BEGIN: com.azure.containers.containerregistry.getManifestAsync + contentClient.getManifest("latest") .doOnNext(downloadResult -> { - if (ManifestMediaType.OCI_MANIFEST.equals(downloadResult.getMediaType()) - || ManifestMediaType.DOCKER_MANIFEST.equals(downloadResult.getMediaType())) { - OciImageManifest manifest = downloadResult.asOciManifest(); + if (ManifestMediaType.OCI_MANIFEST.equals(downloadResult.getManifestMediaType()) + || ManifestMediaType.DOCKER_MANIFEST.equals(downloadResult.getManifestMediaType())) { + OciImageManifest manifest = downloadResult.getManifest().toObject(OciImageManifest.class); System.out.println("Got OCI manifest"); } else { - throw new IllegalArgumentException("Unexpected manifest type: " + downloadResult.getMediaType()); + throw new IllegalArgumentException("Unexpected manifest type: " + downloadResult.getManifestMediaType()); } }) .block(); - // END: com.azure.containers.containerregistry.downloadManifestAsync + // END: com.azure.containers.containerregistry.getManifestAsync } - private static void downloadCustomManifestMediaType() { - DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + private static void getManifestWithResponse() { + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) - .credential(credential) + .repositoryName(REPOSITORY) + .credential(CREDENTIAL) .buildAsyncClient(); - // BEGIN: com.azure.containers.containerregistry.downloadCustomManifestAsync - ManifestMediaType dockerListType = ManifestMediaType - .fromString("application/vnd.docker.distribution.manifest.list.v2+json"); - ManifestMediaType ociIndexType = ManifestMediaType - .fromString("application/vnd.oci.image.index.v1+json"); - - blobClient.downloadManifestWithResponse("latest", Arrays.asList(dockerListType, ociIndexType)) - .doOnNext(downloadResult -> { - if (dockerListType.equals(downloadResult.getValue().getMediaType())) { - // DockerManifestList manifestList = - // downloadResult.getValue().getContent().toObject(DockerManifestList.class); - System.out.println("Got docker manifest list"); - } else if (ociIndexType.equals(downloadResult.getValue().getMediaType())) { - // OciIndex ociIndex = downloadResult.getValue().getContent().toObject(OciIndex.class); - System.out.println("Got OCI index"); + // BEGIN: com.azure.containers.containerregistry.getManifestWithResponseAsync + contentClient.getManifestWithResponse("latest") + .doOnNext(response -> { + GetManifestResult manifestResult = response.getValue(); + if (ManifestMediaType.OCI_MANIFEST.equals(manifestResult.getManifestMediaType()) + || ManifestMediaType.DOCKER_MANIFEST.equals(manifestResult.getManifestMediaType())) { + OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class); + System.out.println("Got OCI manifest"); } else { - throw new IllegalArgumentException("Got unexpected content type: " - + downloadResult.getValue().getMediaType()); + throw new IllegalArgumentException("Unexpected manifest type: " + manifestResult.getManifestMediaType()); } }) .block(); - // END: com.azure.containers.containerregistry.downloadCustomManifestAsync + // END: com.azure.containers.containerregistry.getManifestWithResponseAsync } private static String prettyPrint(OciImageManifest manifest) { diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java index acf812f8f149b..f18685ed60ec5 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/ReadmeSamples.java @@ -6,12 +6,9 @@ import com.azure.containers.containerregistry.models.ArtifactTagProperties; import com.azure.containers.containerregistry.models.ArtifactManifestOrder; import com.azure.containers.containerregistry.models.ContainerRegistryAudience; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.OciDescriptor; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; import com.azure.core.credential.TokenCredential; import com.azure.core.exception.ClientAuthenticationException; import com.azure.core.exception.HttpResponseException; @@ -40,15 +37,15 @@ public void createClient() { // END: readme-sample-createClient } - public void createBlobClient() { - // BEGIN: readme-sample-createBlobClient + public void createContentClient() { + // BEGIN: readme-sample-createContentClient DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(endpoint) .credential(credential) - .repository(repository) + .repositoryName(repository) .buildClient(); - // END: readme-sample-createBlobClient + // END: readme-sample-createContentClient } public void createAsyncClient() { @@ -64,10 +61,10 @@ public void createAsyncClient() { public void createBlobAsyncClient() { // BEGIN: readme-sample-createBlobAsyncClient DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(endpoint) .credential(credential) - .repository(repository) + .repositoryName(repository) .buildAsyncClient(); // END: readme-sample-createBlobAsyncClient } @@ -285,59 +282,59 @@ public void armTokenSample() { } public void deleteBlob() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(getEndpoint()) - .repository(repository) + .repositoryName(repository) .credential(credential) .buildClient(); // BEGIN: readme-sample-deleteBlob - DownloadManifestResult manifestResult = blobClient.downloadManifest("latest"); + GetManifestResult manifestResult = contentClient.getManifest("latest"); - OciImageManifest manifest = manifestResult.asOciManifest(); + OciImageManifest manifest = manifestResult.getManifest().toObject(OciImageManifest.class); for (OciDescriptor layer : manifest.getLayers()) { - blobClient.deleteBlob(layer.getDigest()); + contentClient.deleteBlob(layer.getDigest()); } // END: readme-sample-deleteBlob } public void deleteManifest() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(getEndpoint()) - .repository(repository) + .repositoryName(repository) .credential(credential) .buildClient(); // BEGIN: readme-sample-deleteManifest - DownloadManifestResult manifestResult = blobClient.downloadManifest("latest"); - blobClient.deleteManifest(manifestResult.getDigest()); + GetManifestResult manifestResult = contentClient.getManifest("latest"); + contentClient.deleteManifest(manifestResult.getDigest()); // END: readme-sample-deleteManifest } public void deleteBlobAsync() { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(getEndpoint()) - .repository(repository) + .repositoryName(repository) .credential(credential) .buildAsyncClient(); // BEGIN: readme-sample-deleteBlobAsync - blobClient.downloadManifest("latest") - .flatMap(manifest -> blobClient.deleteBlob(manifest.getDigest())) + contentClient.getManifest("latest") + .flatMap(manifest -> contentClient.deleteBlob(manifest.getDigest())) .block(); // END: readme-sample-deleteBlobAsync } public void deleteManifestAsync() { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(getEndpoint()) - .repository(repository) + .repositoryName(repository) .credential(credential) .buildAsyncClient(); // BEGIN: readme-sample-deleteManifestAsync - blobClient.downloadManifest("latest") - .flatMap(manifest -> blobClient.deleteManifest(manifest.getDigest())) + contentClient.getManifest("latest") + .flatMap(manifest -> contentClient.deleteManifest(manifest.getDigest())) .block(); // END: readme-sample-deleteManifestAsync } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java index c4d7dab49fa10..61127bd261496 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImage.java @@ -6,11 +6,9 @@ import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciDescriptor; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.models.UploadBlobResult; -import com.azure.containers.containerregistry.models.UploadManifestOptions; -import com.azure.containers.containerregistry.models.UploadManifestResult; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; +import com.azure.containers.containerregistry.models.UploadRegistryBlobResult; +import com.azure.containers.containerregistry.models.SetManifestOptions; +import com.azure.containers.containerregistry.models.SetManifestResult; import com.azure.core.http.rest.Response; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; @@ -27,19 +25,17 @@ public class UploadImage { private static final String REPOSITORY = "hello/world"; private static final DefaultAzureCredential CREDENTIAL = new DefaultAzureCredentialBuilder().build(); private static final ManifestMediaType DOCKER_MANIFEST_LIST_TYPE = ManifestMediaType.fromString("application/vnd.docker.distribution.manifest.list.v2+json"); - private static final String OUT_DIRECTORY = getTempDirectory(); public static void main(String[] args) { - - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); // BEGIN: readme-sample-uploadImage BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); - UploadBlobResult configUploadResult = blobClient.uploadBlob(configContent); + UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent); System.out.printf("Uploaded config: digest - %s, size - %s\n", configUploadResult.getDigest(), configContent.getLength()); OciDescriptor configDescriptor = new OciDescriptor() @@ -48,11 +44,11 @@ public static void main(String[] args) { .setSizeInBytes(configContent.getLength()); BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry"); - UploadBlobResult layerUploadResult = blobClient.uploadBlob(layerContent); + UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent); System.out.printf("Uploaded layer: digest - %s, size - %s\n", layerUploadResult.getDigest(), layerContent.getLength()); OciImageManifest manifest = new OciImageManifest() - .setConfig(configDescriptor) + .setConfiguration(configDescriptor) .setSchemaVersion(2) .setLayers(Collections.singletonList( new OciDescriptor() @@ -60,7 +56,7 @@ public static void main(String[] args) { .setSizeInBytes(layerContent.getLength()) .setMediaType("application/octet-stream"))); - UploadManifestResult manifestResult = blobClient.uploadManifest(manifest, "latest"); + SetManifestResult manifestResult = contentClient.setManifest(manifest, "latest"); System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest()); // END: readme-sample-uploadImage @@ -68,46 +64,46 @@ public static void main(String[] args) { } private void uploadBlobBinaryData() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); // BEGIN: com.azure.containers.containerregistry.uploadBlob BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); - UploadBlobResult uploadResult = blobClient.uploadBlob(configContent); + UploadRegistryBlobResult uploadResult = contentClient.uploadBlob(configContent); System.out.printf("Uploaded blob: digest - '%s', size - %s\n", uploadResult.getDigest(), uploadResult.getSizeInBytes()); // END: com.azure.containers.containerregistry.uploadBlob } private void uploadStream() throws IOException { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); // BEGIN: com.azure.containers.containerregistry.uploadStream try (FileInputStream content = new FileInputStream("artifact.tar.gz")) { - UploadBlobResult uploadResult = blobClient.uploadBlob(content.getChannel(), Context.NONE); + UploadRegistryBlobResult uploadResult = contentClient.uploadBlob(content.getChannel(), Context.NONE); System.out.printf("Uploaded blob: digest - '%s', size - %s\n", uploadResult.getDigest(), uploadResult.getSizeInBytes()); } // END: com.azure.containers.containerregistry.uploadStream } - private void uploadManifest() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + private void setManifest() { + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); - UploadBlobResult configUploadResult = blobClient.uploadBlob(configContent); + UploadRegistryBlobResult configUploadResult = contentClient.uploadBlob(configContent); OciDescriptor configDescriptor = new OciDescriptor() .setMediaType("application/vnd.unknown.config.v1+json") @@ -115,10 +111,10 @@ private void uploadManifest() { .setSizeInBytes(configContent.getLength()); BinaryData layerContent = BinaryData.fromString("Hello Azure Container Registry"); - UploadBlobResult layerUploadResult = blobClient.uploadBlob(layerContent); + UploadRegistryBlobResult layerUploadResult = contentClient.uploadBlob(layerContent); OciImageManifest manifest = new OciImageManifest() - .setConfig(configDescriptor) + .setConfiguration(configDescriptor) .setSchemaVersion(2) .setLayers(Collections.singletonList( new OciDescriptor() @@ -126,15 +122,15 @@ private void uploadManifest() { .setSizeInBytes(layerContent.getLength()) .setMediaType("application/octet-stream"))); - // BEGIN: com.azure.containers.containerregistry.uploadManifest - blobClient.uploadManifest(manifest, "v1"); - // END: com.azure.containers.containerregistry.uploadManifest + // BEGIN: com.azure.containers.containerregistry.setManifest + contentClient.setManifest(manifest, "v1"); + // END: com.azure.containers.containerregistry.setManifest } private void uploadCustomManifestMediaType() { - ContainerRegistryBlobClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildClient(); @@ -158,9 +154,9 @@ private void uploadCustomManifestMediaType() { BinaryData manifestList = BinaryData.fromString(manifest); // BEGIN: com.azure.containers.containerregistry.uploadCustomManifest - UploadManifestOptions options = new UploadManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE); + SetManifestOptions options = new SetManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE); - Response response = blobClient.uploadManifestWithResponse(options, Context.NONE); + Response response = contentClient.setManifestWithResponse(options, Context.NONE); System.out.println("Manifest uploaded, digest - " + response.getValue().getDigest()); // END: com.azure.containers.containerregistry.uploadCustomManifest } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java index a226ffb0315ab..9d9b3ca9c6363 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/samples/java/com/azure/containers/containerregistry/UploadImageAsync.java @@ -6,10 +6,8 @@ import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciDescriptor; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.models.UploadManifestOptions; -import com.azure.containers.containerregistry.models.UploadManifestResult; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; +import com.azure.containers.containerregistry.models.SetManifestOptions; +import com.azure.containers.containerregistry.models.SetManifestResult; import com.azure.core.util.BinaryData; import com.azure.core.util.FluxUtil; import com.azure.identity.DefaultAzureCredential; @@ -33,16 +31,16 @@ public class UploadImageAsync { private static final int CHUNK_SIZE = 4 * 1024 * 1024; // content will be uploaded in chunks of up to 4MB size public static void main(String[] args) { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildAsyncClient(); // BEGIN: readme-sample-uploadImageAsync BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); - Mono uploadConfig = blobClient + Mono uploadConfig = contentClient .uploadBlob(configContent) .map(result -> new OciDescriptor() .setMediaType("application/vnd.unknown.config.v1+json") @@ -50,7 +48,7 @@ public static void main(String[] args) { .setSizeInBytes(result.getSizeInBytes())); Flux layerContent = getData(1024 * 1024 * 1024); // 1 GB - Mono uploadLayer = blobClient + Mono uploadLayer = contentClient .uploadBlob(layerContent) .map(result -> new OciDescriptor() .setDigest(result.getDigest()) @@ -59,10 +57,10 @@ public static void main(String[] args) { Mono.zip(uploadConfig, uploadLayer) .map(tuple -> new OciImageManifest() - .setConfig(tuple.getT1()) + .setConfiguration(tuple.getT1()) .setSchemaVersion(2) .setLayers(Collections.singletonList(tuple.getT2()))) - .flatMap(manifest -> blobClient.uploadManifest(manifest, "latest")) + .flatMap(manifest -> contentClient.setManifest(manifest, "latest")) .doOnSuccess(manifestResult -> System.out.printf("Uploaded manifest: digest - %s\n", manifestResult.getDigest())) .block(); // END: readme-sample-uploadImageAsync @@ -91,16 +89,16 @@ private static Flux getData(long size) { }); } - private void uploadManifest() { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + private void setManifest() { + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildAsyncClient(); BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); - Mono config = blobClient + Mono config = contentClient .uploadBlob(configContent) .map(configUploadResult -> new OciDescriptor() .setMediaType("application/vnd.unknown.config.v1+json") @@ -108,7 +106,7 @@ private void uploadManifest() { .setSizeInBytes(configContent.getLength())); Flux layerContent = getData(1024 * 1024 * 1024); // 1 GB - Mono layer = blobClient + Mono layer = contentClient .uploadBlob(layerContent) .map(result -> new OciDescriptor() .setDigest(result.getDigest()) @@ -118,13 +116,13 @@ private void uploadManifest() { config .flatMap(configDescriptor -> layer.flatMap(layerDescriptor -> { - // BEGIN: com.azure.containers.containerregistry.uploadManifestAsync + // BEGIN: com.azure.containers.containerregistry.setManifestAsync OciImageManifest manifest = new OciImageManifest() - .setConfig(configDescriptor) + .setConfiguration(configDescriptor) .setSchemaVersion(2) .setLayers(Collections.singletonList(layerDescriptor)); - Mono result = blobClient.uploadManifest(manifest, "latest"); - // END: com.azure.containers.containerregistry.uploadManifestAsync + Mono result = contentClient.setManifest(manifest, "latest"); + // END: com.azure.containers.containerregistry.setManifestAsync return result; })) .subscribe(result -> System.out.println("Manifest uploaded, digest - " + result.getDigest())); @@ -132,9 +130,9 @@ private void uploadManifest() { private void uploadCustomManifestMediaType() { DefaultAzureCredential credential = new DefaultAzureCredentialBuilder().build(); - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(credential) .buildAsyncClient(); @@ -158,26 +156,26 @@ private void uploadCustomManifestMediaType() { BinaryData manifestList = BinaryData.fromString(manifest); // BEGIN: com.azure.containers.containerregistry.uploadCustomManifestAsync - UploadManifestOptions options = new UploadManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE) + SetManifestOptions options = new SetManifestOptions(manifestList, DOCKER_MANIFEST_LIST_TYPE) .setTag("v2"); - blobClient.uploadManifestWithResponse(options) + contentClient.setManifestWithResponse(options) .subscribe(response -> System.out.println("Manifest uploaded, digest - " + response.getValue().getDigest())); // END: com.azure.containers.containerregistry.uploadCustomManifestAsync } private void uploadBlob() throws FileNotFoundException { - ContainerRegistryBlobAsyncClient blobClient = new ContainerRegistryBlobClientBuilder() + ContainerRegistryContentAsyncClient contentClient = new ContainerRegistryContentClientBuilder() .endpoint(ENDPOINT) - .repository(REPOSITORY) + .repositoryName(REPOSITORY) .credential(CREDENTIAL) .buildAsyncClient(); // BEGIN: com.azure.containers.containerregistry.uploadBlobAsync BinaryData configContent = BinaryData.fromObject(Collections.singletonMap("hello", "world")); - blobClient + contentClient .uploadBlob(configContent) .subscribe(uploadResult -> System.out.printf("Uploaded blob: digest - '%s', size - %s\n", uploadResult.getDigest(), uploadResult.getSizeInBytes())); @@ -186,7 +184,7 @@ private void uploadBlob() throws FileNotFoundException { // BEGIN: com.azure.containers.containerregistry.uploadStreamAsync Flux.using( () -> new FileInputStream("artifact.tar.gz"), - fileStream -> blobClient.uploadBlob(FluxUtil.toFluxByteBuffer(fileStream, CHUNK_SIZE)), + fileStream -> contentClient.uploadBlob(FluxUtil.toFluxByteBuffer(fileStream, CHUNK_SIZE)), this::closeStream) .subscribe(uploadResult -> System.out.printf("Uploaded blob: digest - '%s', size - %s\n", diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryClientsTestBase.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryClientsTestBase.java index 12fd0c599513d..23e6b136c4a92 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryClientsTestBase.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryClientsTestBase.java @@ -9,7 +9,6 @@ import com.azure.containers.containerregistry.models.ArtifactOperatingSystem; import com.azure.containers.containerregistry.models.ArtifactTagProperties; import com.azure.containers.containerregistry.models.ContainerRepositoryProperties; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; import com.azure.core.http.policy.HttpLogDetailLevel; @@ -107,26 +106,28 @@ ContainerRegistryClientBuilder getContainerRegistryBuilder(HttpClient httpClient return getContainerRegistryBuilder(httpClient, credential, REGISTRY_ENDPOINT); } - ContainerRegistryBlobClientBuilder getBlobClientBuilder(String repositoryName, HttpClient httpClient) { + ContainerRegistryContentClientBuilder getContentClientBuilder(String repositoryName, HttpClient httpClient) { TokenCredential credential = getCredentialsByEndpoint(getTestMode(), REGISTRY_ENDPOINT); - return getBlobClientBuilder(repositoryName, httpClient, credential); + return getContentClientBuilder(repositoryName, httpClient, credential); } - ContainerRegistryBlobClientBuilder getBlobClientBuilder(String repositoryName, HttpClient httpClient, + ContainerRegistryContentClientBuilder getContentClientBuilder(String repositoryName, HttpClient httpClient, TokenCredential credential) { - return getBlobClientBuilder(repositoryName, httpClient, credential, REGISTRY_ENDPOINT); + return getContentClientBuilder(repositoryName, httpClient, credential, REGISTRY_ENDPOINT); } - ContainerRegistryBlobClientBuilder getBlobClientBuilder(String repositoryName, HttpClient httpClient, + ContainerRegistryContentClientBuilder getContentClientBuilder(String repositoryName, HttpClient httpClient, TokenCredential credential, String endpoint) { List> redactors = new ArrayList<>(); redactors.add(data -> redact(data, JSON_PROPERTY_VALUE_REDACTION_PATTERN.matcher(data), "REDACTED")); - return new ContainerRegistryBlobClientBuilder() + return new ContainerRegistryContentClientBuilder() .endpoint(getEndpoint(endpoint)) - .repository(repositoryName) + .repositoryName(repositoryName) .httpClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient) - .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS)) + .httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS) + .addAllowedHeaderName("Range") + .addAllowedHeaderName("Content-Range")) .addPolicy(interceptorManager.getRecordPolicy(redactors)) .credential(credential); } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryBlobClientIntegrationTests.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java similarity index 61% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryBlobClientIntegrationTests.java rename to sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java index 8e38b4792232f..b746dd686c5ac 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryBlobClientIntegrationTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientIntegrationTests.java @@ -5,16 +5,14 @@ import com.azure.containers.containerregistry.implementation.models.ManifestList; import com.azure.containers.containerregistry.implementation.models.V2Manifest; import com.azure.containers.containerregistry.models.ArtifactTagProperties; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; import com.azure.containers.containerregistry.models.OciDescriptor; import com.azure.containers.containerregistry.models.OciImageManifest; -import com.azure.containers.containerregistry.models.UploadBlobResult; -import com.azure.containers.containerregistry.models.UploadManifestOptions; -import com.azure.containers.containerregistry.models.UploadManifestResult; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient; -import com.azure.core.exception.ServiceResponseException; +import com.azure.containers.containerregistry.models.UploadRegistryBlobResult; +import com.azure.containers.containerregistry.models.SetManifestOptions; +import com.azure.containers.containerregistry.models.SetManifestResult; +import com.azure.core.exception.ResourceNotFoundException; import com.azure.core.http.HttpClient; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; @@ -23,6 +21,7 @@ import com.azure.core.test.implementation.TestingHelpers; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; @@ -42,10 +41,10 @@ import java.nio.channels.Channels; import java.time.Duration; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Random; +import java.util.concurrent.atomic.AtomicLong; import static com.azure.containers.containerregistry.TestUtils.CONFIG_DATA; import static com.azure.containers.containerregistry.TestUtils.CONFIG_DIGEST; @@ -66,9 +65,9 @@ import static org.junit.jupiter.api.Assumptions.assumeTrue; @Execution(ExecutionMode.SAME_THREAD) -public class ContainerRegistryBlobClientIntegrationTests extends ContainerRegistryClientsTestBase { - private ContainerRegistryBlobClient client; - private ContainerRegistryBlobAsyncClient asyncClient; +public class ContainerRegistryContentClientIntegrationTests extends ContainerRegistryClientsTestBase { + private ContainerRegistryContentClient client; + private ContainerRegistryContentAsyncClient asyncClient; private static final Random RANDOM = new Random(42); private static final byte[] CHUNK = new byte[CHUNK_SIZE]; @@ -102,85 +101,64 @@ void afterEach() { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadOciManifest(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); - uploadManifestPrerequisites(); + setManifestPrerequisites(); - UploadManifestResult result = client.uploadManifest(MANIFEST, null); + SetManifestResult result = client.setManifest(MANIFEST, null); assertNotNull(result); assertNotNull(result.getDigest()); - DownloadManifestResult downloadManifestResult = client.downloadManifest(result.getDigest()); - assertEquals(result.getDigest(), downloadManifestResult.getDigest()); - validateManifest(MANIFEST, downloadManifestResult.asOciManifest()); + GetManifestResult getManifestResult = client.getManifest(result.getDigest()); + assertEquals(result.getDigest(), getManifestResult.getDigest()); + validateManifest(MANIFEST, getManifestResult.getManifest().toObject(OciImageManifest.class)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadOciManifestBinaryData(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); - uploadManifestPrerequisites(); + client = getContentClient("oci-artifact", httpClient); + setManifestPrerequisites(); - UploadManifestOptions options = new UploadManifestOptions(BinaryData.fromObject(MANIFEST), ManifestMediaType.OCI_MANIFEST); - UploadManifestResult result = client.uploadManifestWithResponse(options, Context.NONE).getValue(); + SetManifestOptions options = new SetManifestOptions(BinaryData.fromObject(MANIFEST), ManifestMediaType.OCI_MANIFEST); + SetManifestResult result = client.setManifestWithResponse(options, Context.NONE).getValue(); assertNotNull(result); assertNotNull(result.getDigest()); - DownloadManifestResult downloadManifestResult = client.downloadManifest(MANIFEST_DIGEST); - assertEquals(MANIFEST_DIGEST, downloadManifestResult.getDigest()); - validateManifest(MANIFEST, downloadManifestResult.getContent()); + GetManifestResult getManifestResult = client.getManifest(MANIFEST_DIGEST); + assertEquals(MANIFEST_DIGEST, getManifestResult.getDigest()); + validateManifest(MANIFEST, getManifestResult.getManifest()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadOciManifestViaOptions(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); - uploadManifestPrerequisites(); + client = getContentClient("oci-artifact", httpClient); + setManifestPrerequisites(); - UploadManifestResult result = client.uploadManifestWithResponse(new UploadManifestOptions(MANIFEST), Context.NONE).getValue(); + SetManifestResult result = client.setManifestWithResponse(new SetManifestOptions(MANIFEST), Context.NONE).getValue(); assertNotNull(result); assertNotNull(result.getDigest()); - DownloadManifestResult downloadManifestResult = client.downloadManifest(MANIFEST_DIGEST); - assertEquals(MANIFEST_DIGEST, downloadManifestResult.getDigest()); - validateManifest(MANIFEST, downloadManifestResult.getContent()); - } - - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("getHttpClients") - public void canDownloadManifestWithListOfTypes(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); - uploadManifestPrerequisites(); - - UploadManifestResult result = client.uploadManifest(MANIFEST, null); - assertNotNull(result); - assertNotNull(result.getDigest()); - - List manifestTypes = Arrays.asList(ManifestMediaType.DOCKER_MANIFEST, - ManifestMediaType.OCI_MANIFEST, - ManifestMediaType.fromString("application/vnd.docker.distribution.manifest.list.v2+json"), - ManifestMediaType.fromString("application/vnd.oci.image.index.v1+json")); - - DownloadManifestResult downloadManifestResult = client.downloadManifestWithResponse(MANIFEST_DIGEST, manifestTypes, Context.NONE).getValue(); - assertEquals(MANIFEST_DIGEST, downloadManifestResult.getDigest()); - assertEquals(ManifestMediaType.OCI_MANIFEST, downloadManifestResult.getMediaType()); - validateManifest(MANIFEST, downloadManifestResult.getContent()); + GetManifestResult getManifestResult = client.getManifest(MANIFEST_DIGEST); + assertEquals(MANIFEST_DIGEST, getManifestResult.getDigest()); + validateManifest(MANIFEST, getManifestResult.getManifest()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadOciManifestWithTag(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); String tag = "v1"; - uploadManifestPrerequisites(); + setManifestPrerequisites(); - UploadManifestResult result = client.uploadManifest(MANIFEST, tag); + SetManifestResult result = client.setManifest(MANIFEST, tag); assertNotNull(result); assertNotNull(result.getDigest()); - DownloadManifestResult downloadManifestResult = client.downloadManifest(MANIFEST_DIGEST); - assertEquals(MANIFEST_DIGEST, downloadManifestResult.getDigest()); - validateManifest(MANIFEST, downloadManifestResult.asOciManifest()); + GetManifestResult getManifestResult = client.getManifest(MANIFEST_DIGEST); + assertEquals(MANIFEST_DIGEST, getManifestResult.getDigest()); + validateManifest(MANIFEST, getManifestResult.getManifest().toObject(OciImageManifest.class)); validateTag("oci-artifact", MANIFEST_DIGEST, tag, httpClient); } @@ -188,19 +166,19 @@ public void canUploadOciManifestWithTag(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadDockerManifestWithTag(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); String tag = "v2"; - uploadManifestPrerequisites(); + setManifestPrerequisites(); BinaryData dockerV2Manifest = BinaryData.fromObject(createDockerV2Manifest()); - UploadManifestOptions options = new UploadManifestOptions(dockerV2Manifest, ManifestMediaType.DOCKER_MANIFEST) + SetManifestOptions options = new SetManifestOptions(dockerV2Manifest, ManifestMediaType.DOCKER_MANIFEST) .setTag(tag); - UploadManifestResult result = client.uploadManifestWithResponse(options, Context.NONE).getValue(); + SetManifestResult result = client.setManifestWithResponse(options, Context.NONE).getValue(); assertNotNull(result); assertNotNull(result.getDigest()); - DownloadManifestResult downloadManifestResult = client.downloadManifest(tag); - assertEquals(result.getDigest(), downloadManifestResult.getDigest()); + GetManifestResult getManifestResult = client.getManifest(tag); + assertEquals(result.getDigest(), getManifestResult.getDigest()); validateTag("oci-artifact", result.getDigest(), tag, httpClient); } @@ -208,20 +186,20 @@ public void canUploadDockerManifestWithTag(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadOciManifestAsync(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); asyncClient = getBlobAsyncClient("oci-artifact", httpClient); - uploadManifestPrerequisites(); - StepVerifier.create(asyncClient.uploadManifest(MANIFEST, null) + setManifestPrerequisites(); + StepVerifier.create(asyncClient.setManifest(MANIFEST, null) .flatMap(result -> { assertNotNull(result); assertNotNull(result.getDigest()); - return asyncClient.downloadManifest(MANIFEST_DIGEST); + return asyncClient.getManifest(MANIFEST_DIGEST); })) - .assertNext(downloadManifestResult -> { - assertEquals(MANIFEST_DIGEST, downloadManifestResult.getDigest()); - validateManifest(MANIFEST, downloadManifestResult.asOciManifest()); + .assertNext(getManifestResult -> { + assertEquals(MANIFEST_DIGEST, getManifestResult.getDigest()); + validateManifest(MANIFEST, getManifestResult.getManifest().toObject(OciImageManifest.class)); }) .verifyComplete(); } @@ -229,22 +207,22 @@ public void canUploadOciManifestAsync(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadDockerManifestWithTagAsync(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); asyncClient = getBlobAsyncClient("oci-artifact", httpClient); String tag = "v2"; - uploadManifestPrerequisites(); + setManifestPrerequisites(); BinaryData dockerV2Manifest = BinaryData.fromObject(createDockerV2Manifest()); String digest = computeDigest(dockerV2Manifest.toByteBuffer().asReadOnlyBuffer()); - UploadManifestOptions options = new UploadManifestOptions(dockerV2Manifest, ManifestMediaType.DOCKER_MANIFEST).setTag(tag); - StepVerifier.create(asyncClient.uploadManifestWithResponse(options) + SetManifestOptions options = new SetManifestOptions(dockerV2Manifest, ManifestMediaType.DOCKER_MANIFEST).setTag(tag); + StepVerifier.create(asyncClient.setManifestWithResponse(options) .flatMap(result -> { assertNotNull(result); assertNotNull(result.getValue().getDigest()); - return asyncClient.downloadManifest(tag); + return asyncClient.getManifest(tag); })) - .assertNext(downloadManifestResult -> assertEquals(digest, downloadManifestResult.getDigest())) + .assertNext(getManifestResult -> assertEquals(digest, getManifestResult.getDigest())) .verifyComplete(); validateTag("oci-artifact", digest, tag, httpClient); @@ -253,9 +231,9 @@ public void canUploadDockerManifestWithTagAsync(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void canUploadBlob(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); - UploadBlobResult result = client.uploadBlob(CONFIG_DATA); + UploadRegistryBlobResult result = client.uploadBlob(CONFIG_DATA); assertEquals(CONFIG_DIGEST, result.getDigest()); assertEquals(CONFIG_DATA.getLength(), result.getSizeInBytes()); @@ -266,11 +244,11 @@ public void canUploadBlob(HttpClient httpClient) { public void canUploadHugeBlobInChunks(HttpClient httpClient) throws IOException { assumeTrue(super.getTestMode() == TestMode.LIVE); - client = getBlobClient("oci-artifact", httpClient); + client = getContentClient("oci-artifact", httpClient); - long size = CHUNK_SIZE * 50; + long size = CHUNK_SIZE * 20; TestInputStream input = new TestInputStream(size); - UploadBlobResult result = client.uploadBlob(Channels.newChannel(input), Context.NONE); + UploadRegistryBlobResult result = client.uploadBlob(Channels.newChannel(input), Context.NONE); TestOutputStream output = new TestOutputStream(); client.downloadStream(result.getDigest(), Channels.newChannel(output)); @@ -287,26 +265,24 @@ public void canUploadHugeBlobInChunksAsync(HttpClient httpClient) { asyncClient = getBlobAsyncClient("oci-artifact", httpClient); long size = CHUNK_SIZE * 50; - final TestOutputStream output = new TestOutputStream(); + AtomicLong download = new AtomicLong(0); StepVerifier.setDefaultTimeout(Duration.ofMinutes(30)); - StepVerifier.create(BinaryData.fromFlux(generateAsyncStream(size)) - .flatMap(data -> asyncClient.uploadBlob(data)) - .flatMap(uploadBlobResult -> { - assertEquals(size, uploadBlobResult.getSizeInBytes()); - return asyncClient.downloadStream(uploadBlobResult.getDigest()); - }) - .flatMap(downloadResult -> downloadResult.writeValueTo(Channels.newChannel(output)))) + StepVerifier.create(asyncClient.uploadBlob(generateAsyncStream(size)) + .flatMap(r -> asyncClient.downloadStream(r.getDigest())) + .flatMapMany(bd -> bd.toFluxByteBuffer()) + .doOnNext(bb -> download.addAndGet(bb.remaining())) + .then()) .verifyComplete(); - assertEquals(size, output.getPosition()); + assertEquals(size, download.get()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") public void downloadBlob(HttpClient httpClient) throws IOException { BinaryData content = generateStream((int) (CHUNK_SIZE * 2.1d)); - client = getBlobClient("oci-artifact", httpClient); - UploadBlobResult uploadResult = client.uploadBlob(content); + client = getContentClient("oci-artifact", httpClient); + UploadRegistryBlobResult uploadResult = client.uploadBlob(content); ByteArrayOutputStream stream = new ByteArrayOutputStream(); client.downloadStream(uploadResult.getDigest(), Channels.newChannel(stream)); @@ -318,8 +294,8 @@ public void downloadBlob(HttpClient httpClient) throws IOException { @MethodSource("getHttpClients") public void downloadSmallBlob(HttpClient httpClient) throws IOException { BinaryData content = generateStream(CHUNK_SIZE - 1); - client = getBlobClient("oci-artifact", httpClient); - UploadBlobResult uploadResult = client.uploadBlob(content); + client = getContentClient("oci-artifact", httpClient); + UploadRegistryBlobResult uploadResult = client.uploadBlob(content); ByteArrayOutputStream stream = new ByteArrayOutputStream(); client.downloadStream(uploadResult.getDigest(), Channels.newChannel(stream)); @@ -341,7 +317,7 @@ public void downloadBlobAsync(HttpClient httpClient) throws IOException { assertEquals(digest, uploadResult.getDigest()); return asyncClient.downloadStream(uploadResult.getDigest()); }) - .flatMap(r -> r.writeValueTo(Channels.newChannel(stream)))) + .flatMap(r -> FluxUtil.writeToOutputStream(r.toFluxByteBuffer(), stream))) .verifyComplete(); stream.flush(); @@ -362,7 +338,7 @@ public void downloadSmallBlobAsync(HttpClient httpClient) throws IOException { assertEquals(digest, uploadResult.getDigest()); return asyncClient.downloadStream(uploadResult.getDigest()); }) - .flatMap(r -> r.writeValueTo(Channels.newChannel(stream)))) + .flatMap(r -> FluxUtil.writeToOutputStream(r.toFluxByteBuffer(), stream))) .verifyComplete(); stream.flush(); @@ -371,52 +347,30 @@ public void downloadSmallBlobAsync(HttpClient httpClient) throws IOException { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void downloadManifest(HttpClient httpClient) { - client = getBlobClient("oci-artifact", httpClient); - uploadManifestPrerequisites(); - - UploadManifestResult result = client.uploadManifest(MANIFEST, "latest"); - DownloadManifestResult downloadResult = client.downloadManifest(result.getDigest()); - assertNotNull(downloadResult.asOciManifest()); - validateManifest(MANIFEST, downloadResult.asOciManifest()); + public void getManifest(HttpClient httpClient) { + client = getContentClient("oci-artifact", httpClient); + setManifestPrerequisites(); - downloadResult = client.downloadManifest("latest"); - assertNotNull(downloadResult.asOciManifest()); - validateManifest(MANIFEST, downloadResult.asOciManifest()); - } + SetManifestResult result = client.setManifest(MANIFEST, "latest"); + GetManifestResult downloadResult = client.getManifest(result.getDigest()); + assertNotNull(downloadResult.getManifest().toObject(OciImageManifest.class)); + validateManifest(MANIFEST, downloadResult.getManifest().toObject(OciImageManifest.class)); - @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) - @MethodSource("getHttpClients") - public void downloadManifestAsync(HttpClient httpClient) { - asyncClient = getBlobAsyncClient("oci-artifact", httpClient); - StepVerifier.create( - uploadManifestPrerequisitesAsync() - .then(asyncClient.uploadManifest(MANIFEST, null)) - .flatMap(result -> asyncClient.downloadManifest(result.getDigest()))) - .assertNext(downloadResult -> { - OciImageManifest returnedManifest = downloadResult.asOciManifest(); - assertNotNull(returnedManifest); - validateManifest(MANIFEST, returnedManifest); - }) - .verifyComplete(); + downloadResult = client.getManifest("latest"); + assertNotNull(downloadResult.getManifest().toObject(OciImageManifest.class)); + validateManifest(MANIFEST, downloadResult.getManifest().toObject(OciImageManifest.class)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void downloadManifestWithListOfTypesAsync(HttpClient httpClient) { - List manifestTypes = Arrays.asList(ManifestMediaType.DOCKER_MANIFEST, - ManifestMediaType.OCI_MANIFEST, - ManifestMediaType.fromString("application/vnd.docker.distribution.manifest.list.v2+json"), - ManifestMediaType.fromString("application/vnd.oci.image.index.v1+json")); - + public void getManifestAsync(HttpClient httpClient) { asyncClient = getBlobAsyncClient("oci-artifact", httpClient); StepVerifier.create( - uploadManifestPrerequisitesAsync() - .then(asyncClient.uploadManifest(MANIFEST, null)) - .flatMap(result -> asyncClient.downloadManifestWithResponse(result.getDigest(), manifestTypes)) - .map(response -> response.getValue())) + setManifestPrerequisitesAsync() + .then(asyncClient.setManifest(MANIFEST, null)) + .flatMap(result -> asyncClient.getManifest(result.getDigest()))) .assertNext(downloadResult -> { - OciImageManifest returnedManifest = downloadResult.asOciManifest(); + OciImageManifest returnedManifest = downloadResult.getManifest().toObject(OciImageManifest.class); assertNotNull(returnedManifest); validateManifest(MANIFEST, returnedManifest); }) @@ -425,17 +379,14 @@ public void downloadManifestWithListOfTypesAsync(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void downloadManifestListManifest(HttpClient httpClient) { - client = getBlobClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); + public void getManifestListManifest(HttpClient httpClient) { + client = getContentClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); ManifestMediaType dockerListType = ManifestMediaType.fromString("application/vnd.docker.distribution.manifest.list.v2+json"); - Response manifestResult = client.downloadManifestWithResponse("latest", Collections.singletonList(dockerListType), Context.NONE); + Response manifestResult = client.getManifestWithResponse("latest", Context.NONE); assertNotNull(manifestResult.getValue()); - assertEquals(dockerListType, manifestResult.getValue().getMediaType()); - - assertThrows(IllegalStateException.class, () -> manifestResult.getValue().asOciManifest()); + assertEquals(dockerListType, manifestResult.getValue().getManifestMediaType()); - // does not throw - ManifestList list = manifestResult.getValue().getContent().toObject(ManifestList.class); + ManifestList list = manifestResult.getValue().getManifest().toObject(ManifestList.class); assertEquals(2, list.getSchemaVersion()); assertEquals(dockerListType.toString(), list.getMediaType()); assertEquals(11, list.getManifests().size()); @@ -443,41 +394,40 @@ public void downloadManifestListManifest(HttpClient httpClient) { @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void downloadManifestIncompatibleType(HttpClient httpClient) { - client = getBlobClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); - ManifestMediaType dockerV1 = ManifestMediaType.fromString("application/vnd.docker.distribution.manifest.v1+json"); + public void getManifestIncompatibleType(HttpClient httpClient) { + client = getContentClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); + ManifestMediaType ociArtifactType = ManifestMediaType.fromString("application/vnd.oci.artifact.manifest.v1+json"); - assertThrows(ServiceResponseException.class, () -> client.downloadManifestWithResponse("latest", - Collections.singletonList(dockerV1), Context.NONE)); + BinaryData ociArtifact = BinaryData.fromString("{\"mediaType\": \"application/vnd.oci.artifact.manifest.v1+json\",\"artifactType\": \"application/vnd.example.sbom.v1\"}"); + SetManifestResult result = client.setManifestWithResponse(new SetManifestOptions(ociArtifact, ociArtifactType), Context.NONE) + .getValue(); + assertThrows(ResourceNotFoundException.class, () -> client.getManifestWithResponse(result.getDigest(), Context.NONE)); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void downloadManifestDifferentType(HttpClient httpClient) { - client = getBlobClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); + public void getManifestDifferentType(HttpClient httpClient) { + client = getContentClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); // the original content there is docker v2 manifest list - Response manifestResult = client.downloadManifestWithResponse("latest", - Collections.singletonList(ManifestMediaType.DOCKER_MANIFEST), Context.NONE); + GetManifestResult manifestResult = client.getManifest("latest"); // but service does the best effort to return what it supports - OciImageManifest manifest = manifestResult.getValue().asOciManifest(); - assertEquals(1, manifest.getLayers().size()); - assertEquals("application/vnd.docker.image.rootfs.diff.tar.gzip", manifest.getLayers().get(0).getMediaType()); + assertEquals("application/vnd.docker.distribution.manifest.list.v2+json", manifestResult.getManifestMediaType().toString()); } @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) @MethodSource("getHttpClients") - public void downloadManifestListManifestAsync(HttpClient httpClient) { + public void getManifestListManifestAsync(HttpClient httpClient) { asyncClient = getBlobAsyncClient(HELLO_WORLD_REPOSITORY_NAME, httpClient); ManifestMediaType dockerListType = ManifestMediaType.fromString("application/vnd.docker.distribution.manifest.list.v2+json"); - StepVerifier.create(asyncClient.downloadManifestWithResponse("latest", Collections.singletonList(dockerListType))) + StepVerifier.create(asyncClient.getManifestWithResponse("latest")) .assertNext(manifestResult -> { assertNotNull(manifestResult.getValue()); - assertEquals(dockerListType, manifestResult.getValue().getMediaType()); + assertEquals(dockerListType, manifestResult.getValue().getManifestMediaType()); // does not throw - ManifestList list = manifestResult.getValue().getContent().toObject(ManifestList.class); + ManifestList list = manifestResult.getValue().getManifest().toObject(ManifestList.class); assertEquals(2, list.getSchemaVersion()); assertEquals(dockerListType.toString(), list.getMediaType()); assertEquals(11, list.getManifests().size()); @@ -508,12 +458,12 @@ private void cleanupResources() { } } - private void uploadManifestPrerequisites() { + private void setManifestPrerequisites() { client.uploadBlob(CONFIG_DATA); client.uploadBlob(LAYER_DATA); } - private Mono uploadManifestPrerequisitesAsync() { + private Mono setManifestPrerequisitesAsync() { return asyncClient.uploadBlob(CONFIG_DATA) .then(asyncClient.uploadBlob(LAYER_DATA)) .then(); @@ -547,9 +497,9 @@ private void validateManifest(OciImageManifest originalManifest, BinaryData retu private void validateManifest(OciImageManifest originalManifest, OciImageManifest returnedManifest) { assertNotNull(originalManifest); assertNotNull(returnedManifest); - assertNotNull(returnedManifest.getConfig()); - assertEquals(originalManifest.getConfig().getMediaType(), returnedManifest.getConfig().getMediaType()); - assertEquals(originalManifest.getConfig().getSizeInBytes(), returnedManifest.getConfig().getSizeInBytes()); + assertNotNull(returnedManifest.getConfiguration()); + assertEquals(originalManifest.getConfiguration().getMediaType(), returnedManifest.getConfiguration().getMediaType()); + assertEquals(originalManifest.getConfiguration().getSizeInBytes(), returnedManifest.getConfiguration().getSizeInBytes()); assertNotNull(returnedManifest.getLayers()); assertEquals(originalManifest.getLayers().size(), returnedManifest.getLayers().size()); for (int i = 0; i < originalManifest.getLayers().size(); i++) { @@ -559,12 +509,12 @@ private void validateManifest(OciImageManifest originalManifest, OciImageManifes } } - private ContainerRegistryBlobClient getBlobClient(String repositoryName, HttpClient httpClient) { - return getBlobClientBuilder(repositoryName, buildSyncAssertingClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient)).buildClient(); + private ContainerRegistryContentClient getContentClient(String repositoryName, HttpClient httpClient) { + return getContentClientBuilder(repositoryName, buildSyncAssertingClient(httpClient == null ? interceptorManager.getPlaybackClient() : httpClient)).buildClient(); } - private ContainerRegistryBlobAsyncClient getBlobAsyncClient(String repositoryName, HttpClient httpClient) { - return getBlobClientBuilder(repositoryName, httpClient).buildAsyncClient(); + private ContainerRegistryContentAsyncClient getBlobAsyncClient(String repositoryName, HttpClient httpClient) { + return getContentClientBuilder(repositoryName, httpClient).buildAsyncClient(); } private static BinaryData generateStream(int size) { @@ -588,7 +538,6 @@ private static Flux generateAsyncStream(long size) { buffer.limit((int) remaining); } sink.next(buffer); - return pos + CHUNK.length; }); } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryBlobClientTests.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientTests.java similarity index 66% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryBlobClientTests.java rename to sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientTests.java index 7c02a03b6cf8d..f18b919b5bbad 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryBlobClientTests.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/ContainerRegistryContentClientTests.java @@ -4,11 +4,9 @@ package com.azure.containers.containerregistry; import com.azure.containers.containerregistry.implementation.UtilsImpl; -import com.azure.containers.containerregistry.models.DownloadManifestResult; +import com.azure.containers.containerregistry.models.GetManifestResult; import com.azure.containers.containerregistry.models.ManifestMediaType; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobAsyncClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClient; -import com.azure.containers.containerregistry.specialized.ContainerRegistryBlobClientBuilder; +import com.azure.containers.containerregistry.models.OciImageManifest; import com.azure.core.exception.ServiceResponseException; import com.azure.core.http.HttpClient; import com.azure.core.http.HttpHeaderName; @@ -23,7 +21,7 @@ import com.azure.core.test.http.MockHttpResponse; import com.azure.core.util.BinaryData; import com.azure.core.util.Context; -import com.azure.core.util.io.IOUtils; +import com.azure.core.util.FluxUtil; import com.fasterxml.jackson.databind.util.ByteBufferBackedInputStream; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -33,13 +31,13 @@ import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.Buffer; import java.nio.ByteBuffer; -import java.nio.channels.AsynchronousFileChannel; import java.nio.channels.Channels; import java.nio.channels.WritableByteChannel; import java.nio.charset.StandardCharsets; @@ -48,10 +46,7 @@ import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; import java.util.Random; -import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Function; @@ -70,10 +65,11 @@ import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.fail; -public class ContainerRegistryBlobClientTests { +public class ContainerRegistryContentClientTests { private static final BinaryData SMALL_CONTENT = BinaryData.fromString("foobar"); private static final String SMALL_CONTENT_SHA256 = "sha256:c3ab8ff13720e8ad9047dd39466b3c8974e592c2fa383d4a3960714caef0c4f2"; - private static final String DEFAULT_MANIFEST_CONTENT_TYPE = ManifestMediaType.OCI_MANIFEST + "," + ManifestMediaType.DOCKER_MANIFEST; + private static final String DEFAULT_MANIFEST_CONTENT_TYPE = "*/*," + ManifestMediaType.OCI_MANIFEST + "," + ManifestMediaType.DOCKER_MANIFEST + ",application/vnd.oci.image.index.v1+json" + + ",application/vnd.docker.distribution.manifest.list.v2+json,application/vnd.cncf.oras.artifact.manifest.v1+json"; private static final BinaryData MANIFEST_DATA = BinaryData.fromObject(MANIFEST); private static final BinaryData OCI_INDEX = BinaryData.fromString("{\"schemaVersion\":2,\"mediaType\":\"application/vnd.oci.image.index.v1+json\"," @@ -102,7 +98,7 @@ void beforeEach() { @Test public void downloadBlobWrongDigestInHeaderSync() { - ContainerRegistryBlobClient client = createSyncClient(createDownloadBlobClient(SMALL_CONTENT, DIGEST_UNKNOWN)); + ContainerRegistryContentClient client = createSyncClient(createDownloadContentClient(SMALL_CONTENT, DIGEST_UNKNOWN)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); assertThrows(ServiceResponseException.class, () -> client.downloadStream("some-digest", Channels.newChannel(stream))); @@ -110,118 +106,113 @@ public void downloadBlobWrongDigestInHeaderSync() { @Test public void downloadManigestWrongDigestInHeaderSync() { - ContainerRegistryBlobClient client = createSyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); - assertThrows(ServiceResponseException.class, () -> client.downloadManifest("latest")); + ContainerRegistryContentClient client = createSyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); + assertThrows(ServiceResponseException.class, () -> client.getManifest("latest")); } @Test public void downloadBlobWrongDigestInHeaderAsync() { - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createDownloadBlobClient(SMALL_CONTENT, DIGEST_UNKNOWN)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createDownloadContentClient(SMALL_CONTENT, DIGEST_UNKNOWN)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StepVerifier.create(asyncClient.downloadStream("some-digest") - .flatMap(response -> response.writeValueTo(Channels.newChannel(stream)))) + .flatMap(response -> FluxUtil.writeToOutputStream(response.toFluxByteBuffer(), stream))) .expectError(ServiceResponseException.class) .verify(); } @Test - public void downloadManifestWrongDigestInHeaderAsync() { - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); + public void getManifestWrongDigestInHeaderAsync() { + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); - StepVerifier.create(asyncClient.downloadManifest("latest")) + StepVerifier.create(asyncClient.getManifest("latest")) .expectError(ServiceResponseException.class) .verify(); } @Test public void downloadBlobWrongResponseSync() { - ContainerRegistryBlobClient client = createSyncClient(createDownloadBlobClient(SMALL_CONTENT, DIGEST_UNKNOWN)); + ContainerRegistryContentClient client = createSyncClient(createDownloadContentClient(SMALL_CONTENT, DIGEST_UNKNOWN)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); assertThrows(ServiceResponseException.class, () -> client.downloadStream(SMALL_CONTENT_SHA256, Channels.newChannel(stream))); } @Test - public void downloadManifestWrongResponseSync() { - ContainerRegistryBlobClient client = createSyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); - assertThrows(ServiceResponseException.class, () -> client.downloadManifest("latest")); + public void getManifestWrongResponseSync() { + ContainerRegistryContentClient client = createSyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); + assertThrows(ServiceResponseException.class, () -> client.getManifest("latest")); } @Test public void downloadBlobWrongResponseAsync() { - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createDownloadBlobClient(SMALL_CONTENT, DIGEST_UNKNOWN)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createDownloadContentClient(SMALL_CONTENT, DIGEST_UNKNOWN)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StepVerifier.create(asyncClient.downloadStream(SMALL_CONTENT_SHA256) - .flatMap(response -> response.writeValueTo(Channels.newChannel(stream)))) + .flatMap(response -> FluxUtil.writeToOutputStream(response.toFluxByteBuffer(), stream))) .expectError(ServiceResponseException.class) .verify(); } @Test - public void downloadManifestWrongResponseAsync() { - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); - StepVerifier.create(asyncClient.downloadManifest("latest")) + public void getManifestWrongResponseAsync() { + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, DIGEST_UNKNOWN, null)); + StepVerifier.create(asyncClient.getManifest("latest")) .expectError(ServiceResponseException.class) .verify(); } @SyncAsyncTest - public void downloadManifest() { - ContainerRegistryBlobClient client = createSyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, null)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, null)); + public void getManifest() { + ContainerRegistryContentClient client = createSyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, null)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, null)); - DownloadManifestResult result = SyncAsyncExtension.execute( - () -> client.downloadManifest(MANIFEST_DIGEST), - () -> asyncClient.downloadManifest(MANIFEST_DIGEST)); + GetManifestResult result = SyncAsyncExtension.execute( + () -> client.getManifest(MANIFEST_DIGEST), + () -> asyncClient.getManifest(MANIFEST_DIGEST)); - assertArrayEquals(MANIFEST_DATA.toBytes(), result.getContent().toBytes()); - assertNotNull(result.asOciManifest()); - assertEquals(ManifestMediaType.OCI_MANIFEST, result.getMediaType()); + assertArrayEquals(MANIFEST_DATA.toBytes(), result.getManifest().toBytes()); + assertNotNull(result.getManifest().toObject(ManifestMediaType.class)); + assertEquals(ManifestMediaType.OCI_MANIFEST, result.getManifestMediaType()); } @SyncAsyncTest - public void downloadManifestWithDockerType() { - ContainerRegistryBlobClient client = createSyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, ManifestMediaType.DOCKER_MANIFEST)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, ManifestMediaType.DOCKER_MANIFEST)); + public void getManifestWithDockerType() { + ContainerRegistryContentClient client = createSyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, ManifestMediaType.DOCKER_MANIFEST)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createClientManifests(MANIFEST_DATA, MANIFEST_DIGEST, ManifestMediaType.DOCKER_MANIFEST)); - Collection dockerType = Collections.singletonList(ManifestMediaType.DOCKER_MANIFEST); - Response result = SyncAsyncExtension.execute( - () -> client.downloadManifestWithResponse(MANIFEST_DIGEST, dockerType, Context.NONE), - () -> asyncClient.downloadManifestWithResponse(MANIFEST_DIGEST, dockerType)); + Response result = SyncAsyncExtension.execute( + () -> client.getManifestWithResponse(MANIFEST_DIGEST, Context.NONE), + () -> asyncClient.getManifestWithResponse(MANIFEST_DIGEST)); - assertArrayEquals(MANIFEST_DATA.toBytes(), result.getValue().getContent().toBytes()); - assertNotNull(result.getValue().asOciManifest()); - assertEquals(ManifestMediaType.DOCKER_MANIFEST, result.getValue().getMediaType()); + assertArrayEquals(MANIFEST_DATA.toBytes(), result.getValue().getManifest().toBytes()); + assertNotNull(result.getValue().getManifest().toObject(OciImageManifest.class)); + assertEquals(ManifestMediaType.DOCKER_MANIFEST, result.getValue().getManifestMediaType()); } @SyncAsyncTest - public void downloadManifestWithOciIndexType() { - ContainerRegistryBlobClient client = createSyncClient(createClientManifests(OCI_INDEX, OCI_INDEX_DIGEST, OCI_INDEX_MEDIA_TYPE)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createClientManifests(OCI_INDEX, OCI_INDEX_DIGEST, OCI_INDEX_MEDIA_TYPE)); + public void getManifestWithOciIndexType() { + ContainerRegistryContentClient client = createSyncClient(createClientManifests(OCI_INDEX, OCI_INDEX_DIGEST, OCI_INDEX_MEDIA_TYPE)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createClientManifests(OCI_INDEX, OCI_INDEX_DIGEST, OCI_INDEX_MEDIA_TYPE)); - Collection ociIndexType = Collections.singletonList(OCI_INDEX_MEDIA_TYPE); - Response result = SyncAsyncExtension.execute( - () -> client.downloadManifestWithResponse(OCI_INDEX_DIGEST, ociIndexType, Context.NONE), - () -> asyncClient.downloadManifestWithResponse(OCI_INDEX_DIGEST, ociIndexType)); + Response result = SyncAsyncExtension.execute( + () -> client.getManifestWithResponse(OCI_INDEX_DIGEST, Context.NONE), + () -> asyncClient.getManifestWithResponse(OCI_INDEX_DIGEST)); - assertArrayEquals(OCI_INDEX.toBytes(), result.getValue().getContent().toBytes()); - assertEquals(OCI_INDEX_MEDIA_TYPE, result.getValue().getMediaType()); - - assertThrows(IllegalStateException.class, () -> result.getValue().asOciManifest()); + assertArrayEquals(OCI_INDEX.toBytes(), result.getValue().getManifest().toBytes()); + assertEquals(OCI_INDEX_MEDIA_TYPE, result.getValue().getManifestMediaType()); } @SyncAsyncTest public void downloadBlobOneChunk() throws IOException { - ContainerRegistryBlobClient client = createSyncClient(createDownloadBlobClient(SMALL_CONTENT, SMALL_CONTENT_SHA256)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createDownloadBlobClient(SMALL_CONTENT, SMALL_CONTENT_SHA256)); + ContainerRegistryContentClient client = createSyncClient(createDownloadContentClient(SMALL_CONTENT, SMALL_CONTENT_SHA256)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createDownloadContentClient(SMALL_CONTENT, SMALL_CONTENT_SHA256)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); - WritableByteChannel channel = Channels.newChannel(stream); SyncAsyncExtension.execute( () -> client.downloadStream(SMALL_CONTENT_SHA256, Channels.newChannel(stream)), () -> asyncClient.downloadStream(SMALL_CONTENT_SHA256) - .flatMap(result -> result.writeValueTo(channel))); + .flatMap(result -> FluxUtil.writeToOutputStream(result.toFluxByteBuffer(), stream))); stream.flush(); assertArrayEquals(SMALL_CONTENT.toBytes(), stream.toByteArray()); } @@ -231,15 +222,15 @@ public void downloadBlobMultipleChunks() throws IOException { BinaryData content = getDataSync((int) (CHUNK_SIZE * 2.3), sha256); String expectedDigest = "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobClient client = createSyncClient(createDownloadBlobClient(content, expectedDigest)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createDownloadBlobClient(content, expectedDigest)); + ContainerRegistryContentClient client = createSyncClient(createDownloadContentClient(content, expectedDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createDownloadContentClient(content, expectedDigest)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); WritableByteChannel channel = Channels.newChannel(stream); SyncAsyncExtension.execute( () -> client.downloadStream(expectedDigest, Channels.newChannel(stream)), () -> asyncClient.downloadStream(expectedDigest) - .flatMap(result -> result.writeValueTo(channel))); + .flatMap(result -> FluxUtil.writeToWritableByteChannel(result.toFluxByteBuffer(), channel))); stream.flush(); assertArrayEquals(content.toBytes(), stream.toByteArray()); } @@ -249,8 +240,8 @@ public void uploadBlobSmall() { BinaryData content = getDataSync((int) (CHUNK_SIZE * 0.1), sha256); Supplier calculateDigest = () -> "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobClient client = createSyncClient(createUploadBlobClient(calculateDigest)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(calculateDigest)); + ContainerRegistryContentClient client = createSyncClient(createUploadContentClient(calculateDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(calculateDigest)); SyncAsyncExtension.execute( () -> client.uploadBlob(content), () -> asyncClient.uploadBlob(content)); @@ -261,8 +252,8 @@ public void uploadBlobSmallChunks() { Flux content = getDataAsync(CHUNK_SIZE * 2, CHUNK_SIZE / 10, sha256); Supplier calculateDigest = () -> "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobClient client = createSyncClient(createUploadBlobClient(calculateDigest)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(calculateDigest)); + ContainerRegistryContentClient client = createSyncClient(createUploadContentClient(calculateDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(calculateDigest)); SyncAsyncExtension.execute( () -> client.uploadBlob(BinaryData.fromFlux(content).block()), () -> asyncClient.uploadBlob(content)); @@ -273,8 +264,8 @@ public void uploadBlobBigChunks() { Flux content = getDataAsync(CHUNK_SIZE * 2, (int) (CHUNK_SIZE * 1.5), sha256); Supplier calculateDigest = () -> "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobClient client = createSyncClient(createUploadBlobClient(calculateDigest)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(calculateDigest)); + ContainerRegistryContentClient client = createSyncClient(createUploadContentClient(calculateDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(calculateDigest)); SyncAsyncExtension.execute( () -> client.uploadBlob(BinaryData.fromFlux(content).block()), () -> asyncClient.uploadBlob(content)); @@ -300,7 +291,7 @@ public void uploadVariableChunkSize() { sha256.update(full.asReadOnlyBuffer()); Supplier calculateDigest = () -> "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(calculateDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(calculateDigest)); StepVerifier.create(asyncClient.uploadBlob(content)) .expectNextCount(1) .verifyComplete(); @@ -316,8 +307,8 @@ public void uploadFailWhileReadingInput() { sink.error(new IllegalStateException("foo")); }); - ContainerRegistryBlobClient client = createSyncClient(createUploadBlobClient(() -> "foo")); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(() -> "foo")); + ContainerRegistryContentClient client = createSyncClient(createUploadContentClient(() -> "foo")); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(() -> "foo")); assertThrows(IllegalStateException.class, () -> client.uploadBlob(BinaryData.fromFlux(content).block())); StepVerifier.create(asyncClient.uploadBlob(content)) @@ -337,7 +328,7 @@ public void uploadFromFile() throws IOException { Supplier calculateDigest = () -> "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(calculateDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(calculateDigest)); StepVerifier.create(asyncClient.uploadBlob(BinaryData.fromFile(input.toPath()))) .expectNextCount(1) @@ -351,8 +342,8 @@ public void uploadFromStream() throws IOException { try (ByteBufferBackedInputStream stream = new ByteBufferBackedInputStream(data)) { Supplier calculateDigest = () -> "sha256:" + bytesToHexString(sha256.digest()); - ContainerRegistryBlobClient client = createSyncClient(createUploadBlobClient(calculateDigest)); - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createUploadBlobClient(calculateDigest)); + ContainerRegistryContentClient client = createSyncClient(createUploadContentClient(calculateDigest)); + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createUploadContentClient(calculateDigest)); SyncAsyncExtension.execute( () -> client.uploadBlob(BinaryData.fromStream(stream)), () -> asyncClient.uploadBlob(BinaryData.fromStream(stream))); @@ -360,26 +351,20 @@ public void uploadFromStream() throws IOException { } @Test - public void downloadToFile() throws IOException, InterruptedException, ExecutionException { + public void downloadToFile() throws IOException { File output = File.createTempFile("temp", "in"); - - ContainerRegistryBlobAsyncClient asyncClient = createAsyncClient(createDownloadBlobClient(SMALL_CONTENT, SMALL_CONTENT_SHA256)); - try (AsynchronousFileChannel outputChannel = AsynchronousFileChannel - .open(output.toPath(), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.READ)) { + ContainerRegistryContentAsyncClient asyncClient = createAsyncClient(createDownloadContentClient(SMALL_CONTENT, SMALL_CONTENT_SHA256)); + try (FileOutputStream outputStream = new FileOutputStream(output)) { StepVerifier.create(asyncClient.downloadStream(SMALL_CONTENT_SHA256) - .flatMap(result -> result.writeValueToAsync(IOUtils.toAsynchronousByteChannel(outputChannel, 0)))) + .flatMap(result -> FluxUtil.writeToOutputStream(result.toFluxByteBuffer(), outputStream))) .verifyComplete(); - ByteBuffer result = ByteBuffer.wrap(SMALL_CONTENT.toBytes()); - outputChannel.read(result, 0).get(); - - // make Java 8 happy - Buffer flip = result.flip(); - assertArrayEquals(SMALL_CONTENT.toBytes(), (byte[]) flip.array()); + outputStream.flush(); + assertArrayEquals(SMALL_CONTENT.toBytes(), Files.readAllBytes(output.toPath())); } } - public static HttpClient createDownloadBlobClient(BinaryData content, String digest) { + public static HttpClient createDownloadContentClient(BinaryData content, String digest) { try (InputStream contentStream = content.toStream()) { AtomicLong expectedStartPosition = new AtomicLong(0); long contentLength = content.getLength(); @@ -417,11 +402,7 @@ public static HttpClient createDownloadBlobClient(BinaryData content, String dig public static HttpClient createClientManifests(BinaryData content, String digest, ManifestMediaType returnContentType) { return new MockHttpClient(request -> { - if (returnContentType == null) { - assertEquals(DEFAULT_MANIFEST_CONTENT_TYPE, request.getHeaders().getValue(HttpHeaderName.ACCEPT)); - } else { - assertEquals(returnContentType.toString(), request.getHeaders().getValue(HttpHeaderName.ACCEPT)); - } + assertEquals(DEFAULT_MANIFEST_CONTENT_TYPE, request.getHeaders().getValue(HttpHeaderName.ACCEPT)); HttpHeaders headers = new HttpHeaders() .add(UtilsImpl.DOCKER_DIGEST_HEADER_NAME, digest) .add(HttpHeaderName.CONTENT_TYPE, returnContentType == null ? ManifestMediaType.OCI_MANIFEST.toString() : returnContentType.toString()); @@ -429,7 +410,7 @@ public static HttpClient createClientManifests(BinaryData content, String digest }); } - public static HttpClient createUploadBlobClient(Supplier calculateDigest) { + public static HttpClient createUploadContentClient(Supplier calculateDigest) { AtomicInteger chunkNumber = new AtomicInteger(); return new MockHttpClient(request -> { String expectedReceivedLocation = String.valueOf(chunkNumber.getAndIncrement()); @@ -479,18 +460,18 @@ private Flux getDataAsync(long size, int chunkSize, MessageDigest sh }); } - private ContainerRegistryBlobClient createSyncClient(HttpClient httpClient) { - return new ContainerRegistryBlobClientBuilder() + private ContainerRegistryContentClient createSyncClient(HttpClient httpClient) { + return new ContainerRegistryContentClientBuilder() .endpoint("https://endpoint.com") - .repository("foo") + .repositoryName("foo") .httpClient(httpClient) .buildClient(); } - private ContainerRegistryBlobAsyncClient createAsyncClient(HttpClient httpClient) { - return new ContainerRegistryBlobClientBuilder() + private ContainerRegistryContentAsyncClient createAsyncClient(HttpClient httpClient) { + return new ContainerRegistryContentClientBuilder() .endpoint("https://endpoint.com") - .repository("foo") + .repositoryName("foo") .httpClient(httpClient) .buildAsyncClient(); } diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java index afca2ff4bfca4..6deaed00709de 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/java/com/azure/containers/containerregistry/TestUtils.java @@ -216,7 +216,8 @@ static void importImage(TestMode mode, String registryName, String repository, L private static OciImageManifest createManifest() { OciImageManifest manifest = new OciImageManifest() - .setConfig(new OciDescriptor() + .setSchemaVersion(2) + .setConfiguration(new OciDescriptor() .setMediaType("application/vnd.acme.rocket.config.v1+json") .setDigest(CONFIG_DIGEST) .setSizeInBytes(171L)); diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canDownloadManifestWithListOfTypes[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canDownloadManifestWithListOfTypes[1].json deleted file mode 100644 index d468991edf652..0000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canDownloadManifestWithListOfTypes[1].json +++ /dev/null @@ -1,453 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "bce26712-f266-435b-b0c0-c1f6fec28adf", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "de8df4a7-d788-45c6-9d08-e3d3d6134056", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.683333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "17e307ca-29fa-445a-af57-de16f27be364", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c460f878-b54a-4086-8a1b-cc00a7a20b30", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.4", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "321da019-82c7-40f8-895e-46d4d5cd9c7c" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "Range" : "0-0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "27044e39-89a9-4802-a386-1d515374a16d", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "c811ebe8-9673-41d1-9947-daa7ae22d655", - "X-Ms-Client-Request-Id" : "321da019-82c7-40f8-895e-46d4d5cd9c7c", - "Docker-Upload-Uuid" : "13ac981d-51fe-4fd0-ac7a-264cc1bf30df", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/uploads/13ac981d-51fe-4fd0-ac7a-264cc1bf30df?_nouploadcache=false&_state=SEavvk9AqF5jSgAQOBPRFJx5HS6bj8laLojrLMf62eF7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiMTNhYzk4MWQtNTFmZS00ZmQwLWFjN2EtMjY0Y2MxYmYzMGRmIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjIxLjI4NDUwMjU0WiJ9" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "e50d2704-39a2-45e6-a57b-99eb6ba12ba1", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "79771062-6940-43e7-bd3e-276427a0269d", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.666667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PUT", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/13ac981d-51fe-4fd0-ac7a-264cc1bf30df?_nouploadcache=false&_state=SEavvk9AqF5jSgAQOBPRFJx5HS6bj8laLojrLMf62eF7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiMTNhYzk4MWQtNTFmZS00ZmQwLWFjN2EtMjY0Y2MxYmYzMGRmIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjIxLjI4NDUwMjU0WiJ9&digest=sha256%3A44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "295f3bbc-78f0-4acf-8c9b-d522bc0c770e", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "201", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Docker-Content-Digest" : "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "053a3089-644e-4e13-bb6b-a54e3c6613f7", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "60f429e0-a8da-43a5-8ddc-f4e10ba68d2b", - "X-Ms-Client-Request-Id" : "295f3bbc-78f0-4acf-8c9b-d522bc0c770e", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "b14ea42c-d6db-4c0f-a62b-4dba0d9a0b0c", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "138f8018-a106-485b-885a-347d09f00f92", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.383333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "2b13b382-48fc-41c0-ad75-62d275731f95" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "Range" : "0-0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "e79f1349-29a2-46a1-819f-f2c58b03c3fd", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "de39f2eb-b4bb-4264-8a49-edbd9c7885a0", - "X-Ms-Client-Request-Id" : "2b13b382-48fc-41c0-ad75-62d275731f95", - "Docker-Upload-Uuid" : "9df3e81e-578f-428e-b551-01343849f303", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/uploads/9df3e81e-578f-428e-b551-01343849f303?_nouploadcache=false&_state=FwuATEyWzOuXr1uvk-Cxp-Dq7uqz8ApAStpW-zOvWk97Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiOWRmM2U4MWUtNTc4Zi00MjhlLWI1NTEtMDEzNDM4NDlmMzAzIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjIxLjYxMjY4MDgyMVoifQ%3D%3D" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "1992ad1d-4938-4838-91d7-9be160606705", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "77019631-aa9b-4573-9e33-e7bd20d7ad36", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.65", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PUT", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/9df3e81e-578f-428e-b551-01343849f303?_nouploadcache=false&_state=FwuATEyWzOuXr1uvk-Cxp-Dq7uqz8ApAStpW-zOvWk97Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiOWRmM2U4MWUtNTc4Zi00MjhlLWI1NTEtMDEzNDM4NDlmMzAzIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjIxLjYxMjY4MDgyMVoifQ%3D%3D&digest=sha256%3Ab94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "2db1f2de-8784-4129-bdc5-55328ec0ae9e", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "201", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Docker-Content-Digest" : "sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "669e20fd-448a-4723-8850-89aff0b3e48d", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "3ecb956a-b768-4cdd-8eac-e0abf7baaf40", - "X-Ms-Client-Request-Id" : "2db1f2de-8784-4129-bdc5-55328ec0ae9e", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "1a024a00-a999-4814-94ee-6e139331444c", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2e9d1c8d-bedd-42f7-864e-e5ae86806325", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.366667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:21 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PUT", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "018a7d70-2deb-4000-b3b6-7e0e217a8496", - "Content-Type" : "application/vnd.oci.image.manifest.v1+json" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "201", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Docker-Content-Digest" : "sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d86706f7-1bed-4980-8699-48726e8e5fbb", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "1f4f44b5-d7eb-481a-a331-eb57eee8293c", - "X-Ms-Client-Request-Id" : "018a7d70-2deb-4000-b3b6-7e0e217a8496", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "4bd313da-4ec6-4656-9c05-a6e2039d7352", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "6bd9199d-239b-48ba-9910-dbf929e50b7f", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.633333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "GET", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "8f17c049-ddcc-4113-bb68-d39e80f2bdfb" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Docker-Content-Digest" : "sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "dc5b9095-729a-4c91-b7ea-1329a1e65659", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "1fab99c2-9365-4d80-a318-3842fe1a255e", - "X-Ms-Client-Request-Id" : "8f17c049-ddcc-4113-bb68-d39e80f2bdfb", - "Etag" : "\"sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598\"", - "Content-Length" : "459", - "Body" : "{\"schemaVersion\":2,\"config\":{\"mediaType\":\"application/vnd.acme.rocket.config.v1+json\",\"size\":171,\"digest\":\"sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a\"},\"layers\":[{\"mediaType\":\"application/vnd.oci.image.layer.v1.tar\",\"size\":28,\"digest\":\"sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\"annotations\":{\"org.opencontainers.image.ref.name\":\"654b93f61054e4ce90ed203bb8d556a6200d5f906cf3eca0620738d6dc18cbed\"}}]}", - "Content-Type" : "application/vnd.oci.image.manifest.v1+json" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "beb4686e-4692-496d-9f67-3f0d4b60f4b5", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "ca315cac-3968-4d16-a15e-8700f95d4ad2", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.616667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d07bfd04-42c8-4d02-adcb-e6f8cf462b52" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "2c271437-2a65-4d38-ad6e-b6f617dcf125", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "966d44fa-b448-40ed-86a0-17edf04d4559", - "X-Ms-Client-Request-Id" : "d07bfd04-42c8-4d02-adcb-e6f8cf462b52", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "32.000000", - "Content-Length" : "0" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "ddb5acdc-0fd6-4ee3-b5f4-70ec86fdc397", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "59a14abe-591c-4360-b8de-b157a6806616", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "331.983333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "6d55295a-94b1-4298-9c58-89b3a643955a" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a7f04e4d-a7e9-4b50-8ec9-997c6ce29791", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "f7e5effa-7158-4143-ac0e-b7cbf5ce80e3", - "X-Ms-Client-Request-Id" : "6d55295a-94b1-4298-9c58-89b3a643955a", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "31.000000", - "Content-Length" : "0" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "ae7bc863-3fa4-4996-80f7-96692904d0ed", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "05437644-a5d2-4f72-8ea2-78b9356f5d04", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "331.966667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "60629951-ed91-4478-ba27-60d8dae6b14f" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:22 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "2d1fba96-45c6-4f5d-925c-303829958dcf", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "ac2bc7cd-d1b5-4266-9b2d-db3e790d709d", - "X-Ms-Client-Request-Id" : "60629951-ed91-4478-ba27-60d8dae6b14f", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "30.000000", - "Content-Length" : "0" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestWithListOfTypesAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestWithListOfTypesAsync[1].json deleted file mode 100644 index bc84cf7211124..0000000000000 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestWithListOfTypesAsync[1].json +++ /dev/null @@ -1,549 +0,0 @@ -{ - "networkCallRecords" : [ { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "a0a90370-016a-426d-b661-f5bb584b8a27", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e9bc7d1e-595b-402d-8697-8fb6358f9a1a", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.85", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "8eee0589-19c8-4609-afdc-1821569b5dd7", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "697a9e35-7a58-4009-9253-b5b3cf3b19a2", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.066667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "f9969265-2c11-49e5-8c71-7d01b8928c58" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "Range" : "0-0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "40dbba0b-6c0b-4d5e-851e-a0171598a9ff", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "c839544d-1ea1-4889-b7e5-f582b1e81cf8", - "X-Ms-Client-Request-Id" : "f9969265-2c11-49e5-8c71-7d01b8928c58", - "Docker-Upload-Uuid" : "5ac0e651-090f-446f-a8dc-c03c91ab371e", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/uploads/5ac0e651-090f-446f-a8dc-c03c91ab371e?_nouploadcache=false&_state=kVd9tn-G20hYbaloVwHBrd31giJ3OGVNLg5C1ZCXXFp7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiNWFjMGU2NTEtMDkwZi00NDZmLWE4ZGMtYzAzYzkxYWIzNzFlIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjAyLjUxNjkxNDU4NFoifQ%3D%3D" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "8323d473-7e6e-4d35-8443-78be466861b8", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "da25cd60-a659-46f9-965c-8929a637445c", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.833333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PATCH", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/5ac0e651-090f-446f-a8dc-c03c91ab371e?_nouploadcache=false&_state=kVd9tn-G20hYbaloVwHBrd31giJ3OGVNLg5C1ZCXXFp7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiNWFjMGU2NTEtMDkwZi00NDZmLWE4ZGMtYzAzYzkxYWIzNzFlIiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjAyLjUxNjkxNDU4NFoifQ%3D%3D", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "b064bf65-cda0-4475-8778-8c55bf175715", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "Range" : "0-1", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a6225cd0-4505-4b23-9896-43a6ba9a661a", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "3067703d-eacf-4da5-ba87-25704bef3f03", - "X-Ms-Client-Request-Id" : "b064bf65-cda0-4475-8778-8c55bf175715", - "Docker-Upload-Uuid" : "5ac0e651-090f-446f-a8dc-c03c91ab371e", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/uploads/5ac0e651-090f-446f-a8dc-c03c91ab371e?_nouploadcache=false&_state=N8ZmhfKCBBa1jbMpmBY-FTxnxgm0E7RCIwDile1W0nZ7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiNWFjMGU2NTEtMDkwZi00NDZmLWE4ZGMtYzAzYzkxYWIzNzFlIiwiT2Zmc2V0IjoyLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjAyWiJ9" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d5105e1d-f637-4dd1-98e8-f37d0e99697a", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "e3cb73d8-ea7b-4ef3-9d26-17f6b0f9866a", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.05", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PUT", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/5ac0e651-090f-446f-a8dc-c03c91ab371e?_nouploadcache=false&_state=N8ZmhfKCBBa1jbMpmBY-FTxnxgm0E7RCIwDile1W0nZ7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiNWFjMGU2NTEtMDkwZi00NDZmLWE4ZGMtYzAzYzkxYWIzNzFlIiwiT2Zmc2V0IjoyLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjAyWiJ9&digest=sha256%3A44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "5ffa387f-fbab-49ed-ae45-828acfbdecb8" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "201", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Docker-Content-Digest" : "sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "8ab4ba5b-a76b-46a9-91a7-ddf1c57ab649", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "f739542c-cbec-495d-9bc0-ca6751cd48a4", - "X-Ms-Client-Request-Id" : "5ffa387f-fbab-49ed-ae45-828acfbdecb8", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "b91358aa-6972-4dfd-880d-85eb46ad5850", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "2e439d30-e186-4542-a890-4e8695cd4323", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.816667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:02 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d7b2722a-1a72-4a78-b020-6e4ac6060b2c" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "Range" : "0-0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "09462bba-bc71-4eb1-993d-1dfe4551536a", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "3f3700da-387d-45e6-a943-0384a63290d7", - "X-Ms-Client-Request-Id" : "d7b2722a-1a72-4a78-b020-6e4ac6060b2c", - "Docker-Upload-Uuid" : "cd694244-7d07-48af-b11f-2bdba7cb8789", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/uploads/cd694244-7d07-48af-b11f-2bdba7cb8789?_nouploadcache=false&_state=-E9V28TNpXONNCWIUXtjuyhmgakZcLeUmVtFWpeb1Kh7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiY2Q2OTQyNDQtN2QwNy00OGFmLWIxMWYtMmJkYmE3Y2I4Nzg5IiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjAyLjk4NjUyODUxNVoifQ%3D%3D" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "94adb947-8c8d-49a5-aa36-1c98b4f8bbce", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "9faefc4c-5370-4ebe-9fcc-c5977f10a793", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.033333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PATCH", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/cd694244-7d07-48af-b11f-2bdba7cb8789?_nouploadcache=false&_state=-E9V28TNpXONNCWIUXtjuyhmgakZcLeUmVtFWpeb1Kh7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiY2Q2OTQyNDQtN2QwNy00OGFmLWIxMWYtMmJkYmE3Y2I4Nzg5IiwiT2Zmc2V0IjowLCJTdGFydGVkQXQiOiIyMDIzLTAzLTExVDAwOjMxOjAyLjk4NjUyODUxNVoifQ%3D%3D", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "955ddc9c-44a6-4a8a-9540-3f3d7bd28ae6", - "Content-Type" : "application/octet-stream" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "Range" : "0-10", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "5f8555fd-bb46-40f6-919e-dfb8af0a2c38", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "8535611e-b1ec-4b66-8955-c5c402c48770", - "X-Ms-Client-Request-Id" : "955ddc9c-44a6-4a8a-9540-3f3d7bd28ae6", - "Docker-Upload-Uuid" : "cd694244-7d07-48af-b11f-2bdba7cb8789", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/uploads/cd694244-7d07-48af-b11f-2bdba7cb8789?_nouploadcache=false&_state=zWRbAZIzbVWRdRwk-6GnRxOz6nSeMn9jdxT10NXHGBJ7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiY2Q2OTQyNDQtN2QwNy00OGFmLWIxMWYtMmJkYmE3Y2I4Nzg5IiwiT2Zmc2V0IjoxMSwiU3RhcnRlZEF0IjoiMjAyMy0wMy0xMVQwMDozMTowMloifQ%3D%3D" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "62d104a9-7886-4bb6-a03e-9a19337b8a7a", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "5ca1a014-f8c7-4065-b064-a86d14df12c0", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.8", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PUT", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/uploads/cd694244-7d07-48af-b11f-2bdba7cb8789?_nouploadcache=false&_state=zWRbAZIzbVWRdRwk-6GnRxOz6nSeMn9jdxT10NXHGBJ7Ik5hbWUiOiJvY2ktYXJ0aWZhY3QiLCJVVUlEIjoiY2Q2OTQyNDQtN2QwNy00OGFmLWIxMWYtMmJkYmE3Y2I4Nzg5IiwiT2Zmc2V0IjoxMSwiU3RhcnRlZEF0IjoiMjAyMy0wMy0xMVQwMDozMTowMloifQ%3D%3D&digest=sha256%3Ab94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "7c6e4edb-3ea5-48ac-a525-035b8cfbe0e8" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "201", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Docker-Content-Digest" : "sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d204e54b-ec42-4b60-ad98-a300c8b621c5", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "6156b329-d8a3-4a14-a7e6-a08fba09db67", - "X-Ms-Client-Request-Id" : "7c6e4edb-3ea5-48ac-a525-035b8cfbe0e8", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/blobs/sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "739809cb-b65b-4ac5-9eba-97c32f8bf153", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "cda2a7ed-4276-44a9-b617-96f665c715df", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.016667", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "PUT", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "ba9be621-47f7-4c9e-a225-55367b4782b8", - "Content-Type" : "application/vnd.oci.image.manifest.v1+json" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "201", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Docker-Content-Digest" : "sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "d469a8d8-5562-4651-8c00-5326e0d4bc20", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "5f7ff146-974d-41b7-aa51-797b368dd737", - "X-Ms-Client-Request-Id" : "ba9be621-47f7-4c9e-a225-55367b4782b8", - "Content-Length" : "0", - "Location" : "/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "71defc9c-55e4-4692-996a-7189ab4f50fe", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "96c86585-73df-473b-a732-150fff2dd8c4", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.783333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "GET", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "0d7cdce6-2c4d-4e62-9e53-b54d4ed53f4f" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Docker-Content-Digest" : "sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "af892a26-d49e-400b-9a29-9aca7c5b230a", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "658a018d-2c0d-40fd-803c-e89c79069e01", - "X-Ms-Client-Request-Id" : "0d7cdce6-2c4d-4e62-9e53-b54d4ed53f4f", - "Etag" : "\"sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598\"", - "Content-Length" : "459", - "Body" : "{\"schemaVersion\":2,\"config\":{\"mediaType\":\"application/vnd.acme.rocket.config.v1+json\",\"size\":171,\"digest\":\"sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a\"},\"layers\":[{\"mediaType\":\"application/vnd.oci.image.layer.v1.tar\",\"size\":28,\"digest\":\"sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9\",\"annotations\":{\"org.opencontainers.image.ref.name\":\"654b93f61054e4ce90ed203bb8d556a6200d5f906cf3eca0620738d6dc18cbed\"}}]}", - "Content-Type" : "application/vnd.oci.image.manifest.v1+json" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "904500ce-1634-46a4-9507-0aa086761b7b", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "cd7873a5-70fb-44cd-8d4c-9cebe5442f18", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.7", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d0c18aca-2459-4e6c-a845-b1de33312438" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:03 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "72ca9b7c-ab61-45da-b373-ebc89ddcd079", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "5a36295e-0ffb-4c6d-b92f-40e687e164e1", - "X-Ms-Client-Request-Id" : "d0c18aca-2459-4e6c-a845-b1de33312438", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "32.000000", - "Content-Length" : "0" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "25e1a06e-9b54-41f7-bc36-7eacd48c0b9d", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c49137a5-ff28-4f2c-b865-48239ff25066", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.9", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:04 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/blobs/sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "0281cee7-e94e-48d2-9a8d-dc547f39ea26" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:04 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "362336c7-e516-4d2e-aee1-164b3273026f", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "91d3d886-b52f-44a5-aea2-36fa7253809d", - "X-Ms-Client-Request-Id" : "0281cee7-e94e-48d2-9a8d-dc547f39ea26", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "31.000000", - "Content-Length" : "0" - }, - "Exception" : null - }, { - "Method" : "POST", - "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "648f1bd2-a104-45bf-9136-5adc769c7d97", - "Content-Type" : "application/x-www-form-urlencoded" - }, - "Response" : { - "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "c064ff7c-afe1-4b37-b1ba-a9d37622b107", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", - "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.683333", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "200", - "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Sat, 11 Mar 2023 00:31:04 GMT", - "Content-Type" : "application/json; charset=utf-8" - }, - "Exception" : null - }, { - "Method" : "DELETE", - "Uri" : "https://REDACTED.azurecr.io/v2/oci-artifact/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", - "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "bb60aa36-87d6-49f9-a3f5-9aee8f436e43" - }, - "Response" : { - "Server" : "openresty", - "X-Content-Type-Options" : "nosniff", - "Connection" : "keep-alive", - "retry-after" : "0", - "StatusCode" : "202", - "Date" : "Sat, 11 Mar 2023 00:31:04 GMT", - "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "4130e174-6706-4ac2-8348-d1ca073885cd", - "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", - "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "d3b8d90d-1951-4d0e-9042-b8958e502a08", - "X-Ms-Client-Request-Id" : "bb60aa36-87d6-49f9-a3f5-9aee8f436e43", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "30.000000", - "Content-Length" : "0" - }, - "Exception" : null - } ], - "variables" : [ ] -} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegerationTests.uploadManifest[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegerationTests.uploadManifest[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegerationTests.uploadManifest[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegerationTests.uploadManifest[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadBlob[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadBlob[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadBlob[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadBlob[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadDockerManifestWithTagAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadDockerManifestWithTagAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadDockerManifestWithTagAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadDockerManifestWithTagAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadDockerManifestWithTag[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadDockerManifestWithTag[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadDockerManifestWithTag[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadDockerManifestWithTag[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadHugeBlobInChunksAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadHugeBlobInChunksAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadHugeBlobInChunksAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadHugeBlobInChunksAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadHugeBlobInChunks[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadHugeBlobInChunks[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadHugeBlobInChunks[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadHugeBlobInChunks[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestBinaryData[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestBinaryData[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestBinaryData[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestBinaryData[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestViaOptions[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestViaOptions[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestViaOptions[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestViaOptions[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestWithTag[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestWithTag[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifestWithTag[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifestWithTag[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifest[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifest[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.canUploadOciManifest[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.canUploadOciManifest[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadBlobAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadBlobAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadBlobAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadBlobAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadBlob[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadBlob[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadBlob[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadBlob[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadSmallBlobAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadSmallBlobAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadSmallBlobAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadSmallBlobAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadSmallBlob[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadSmallBlob[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadSmallBlob[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.downloadSmallBlob[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestIncompatibleType[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestDifferentType[1].json similarity index 52% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestIncompatibleType[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestDifferentType[1].json index 303767d83d2c8..7e19e2fbd8435 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestIncompatibleType[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestDifferentType[1].json @@ -3,21 +3,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "cf527caf-b438-4aa1-8674-a5df02a75317", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "304770e6-ed38-4223-bbf4-732b5fcf069d", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "f6eecb9c-29d4-4bc9-a448-f98620fe7ec3", + "X-Ms-Correlation-Request-Id" : "7b0dc6e8-d560-44f8-a6fa-7fe20a99a749", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.5", + "x-ms-ratelimit-remaining-calls-per-second" : "332.95", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:03 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -25,21 +25,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "956784e9-12e4-4978-b465-1436499af5bf", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "e71d8daf-5f42-4158-b15d-8ce828082ab7", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "3f94690f-071c-4d03-80e9-7c6b2bad04e4", + "X-Ms-Correlation-Request-Id" : "33336f75-7e38-4b7a-9825-de9cf5a7984d", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.883333", + "x-ms-ratelimit-remaining-calls-per-second" : "333.05", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:03 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -47,8 +47,8 @@ "Method" : "GET", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/manifests/latest", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "7f452ace-dc59-4541-a94f-f953f30dc65e" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "afe8ba9d-6687-45f0-88fa-43094c54edfc" }, "Response" : { "Server" : "openresty", @@ -56,39 +56,39 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", - "Date" : "Fri, 10 Mar 2023 02:48:03 GMT", - "Docker-Content-Digest" : "sha256:f22b12a8e1e51b533588b4ea81af13d7210dd6663373dbd3b284ca926ffa5da0", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", + "Docker-Content-Digest" : "sha256:ffb13da98453e0f04d33a6eee5bb8e46ee50d08ebe17735fc0779d0349e889e9", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "180a9850-9971-4f23-b5d5-9e4fcb0ceffe", + "X-Ms-Correlation-Request-Id" : "e47d469a-5d16-4ce7-be9d-93f966bcfc2a", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "b9b39dd6-a43a-491f-a117-11d151af4b6c", - "X-Ms-Client-Request-Id" : "7f452ace-dc59-4541-a94f-f953f30dc65e", - "Etag" : "\"sha256:f22b12a8e1e51b533588b4ea81af13d7210dd6663373dbd3b284ca926ffa5da0\"", - "Content-Length" : "2747", - "Body" : "{\n \"schemaVersion\": 1,\n \"name\": \"library/hello-world\",\n \"tag\": \"latest\",\n \"architecture\": \"amd64\",\n \"fsLayers\": [\n {\n \"blobSum\": \"sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4\"\n },\n {\n \"blobSum\": \"sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54\"\n }\n ],\n \"history\": [\n {\n \"v1Compatibility\": \"{\\\"architecture\\\":\\\"amd64\\\",\\\"config\\\":{\\\"Hostname\\\":\\\"\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\"],\\\"Cmd\\\":[\\\"/hello\\\"],\\\"Image\\\":\\\"sha256:b9935d4e8431fb1a7f0989304ec86b3329a99a25f5efdc7f09f3f8c41434ca6d\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"\\\",\\\"Entrypoint\\\":null,\\\"OnBuild\\\":null,\\\"Labels\\\":null},\\\"container\\\":\\\"8746661ca3c2f215da94e6d3f7dfdcafaff5ec0b21c9aff6af3dc379a82fbc72\\\",\\\"container_config\\\":{\\\"Hostname\\\":\\\"8746661ca3c2\\\",\\\"Domainname\\\":\\\"\\\",\\\"User\\\":\\\"\\\",\\\"AttachStdin\\\":false,\\\"AttachStdout\\\":false,\\\"AttachStderr\\\":false,\\\"Tty\\\":false,\\\"OpenStdin\\\":false,\\\"StdinOnce\\\":false,\\\"Env\\\":[\\\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\\\"],\\\"Cmd\\\":[\\\"/bin/sh\\\",\\\"-c\\\",\\\"#(nop) \\\",\\\"CMD [\\\\\\\"/hello\\\\\\\"]\\\"],\\\"Image\\\":\\\"sha256:b9935d4e8431fb1a7f0989304ec86b3329a99a25f5efdc7f09f3f8c41434ca6d\\\",\\\"Volumes\\\":null,\\\"WorkingDir\\\":\\\"\\\",\\\"Entrypoint\\\":null,\\\"OnBuild\\\":null,\\\"Labels\\\":{}},\\\"created\\\":\\\"2021-09-23T23:47:57.442225064Z\\\",\\\"docker_version\\\":\\\"20.10.7\\\",\\\"id\\\":\\\"a1f125167a7f2cffa48b7851ff3f75e983824c16e8da61f20765eb55f7b3a594\\\",\\\"os\\\":\\\"linux\\\",\\\"parent\\\":\\\"cd13bf215b21e9bc78460fa5070860a498671e2ac282d86d15042cf0c26e6e8b\\\",\\\"throwaway\\\":true}\"\n },\n {\n \"v1Compatibility\": \"{\\\"id\\\":\\\"cd13bf215b21e9bc78460fa5070860a498671e2ac282d86d15042cf0c26e6e8b\\\",\\\"created\\\":\\\"2021-09-23T23:47:57.098990892Z\\\",\\\"container_config\\\":{\\\"Cmd\\\":[\\\"/bin/sh -c #(nop) COPY file:50563a97010fd7ce1ceebd1fa4f4891ac3decdf428333fb2683696f4358af6c2 in / \\\"]}}\"\n }\n ],\n \"signatures\": [\n {\n \"header\": {\n \"jwk\": {\n \"crv\": \"P-256\",\n \"kid\": \"XII7:C4CL:NMZ7:FI4T:HI6N:MVOL:ZQUH:6RWO:ABIK:SD4V:FYDS:BWXZ\",\n \"kty\": \"EC\",\n \"x\": \"ZzTrnuAoT8lr3jlH5W_p6RRYaH0STb4nuPG8WcGXQu8\",\n \"y\": \"fZXwo506w0bDSMQM4_4QsZV7lSpaUG74UCoIEDHq8Mk\"\n },\n \"alg\": \"ES256\"\n },\n \"signature\": \"ciCP30zrZ6Awm9s-tsg7gVLOwbvRMB2mOyHvsSBcLWae2d4ca7P124kfHq_xCV8zzeDtQMxzVIHkwP792zFc3g\",\n \"protected\": \"eyJmb3JtYXRMZW5ndGgiOjIxMDAsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAyMy0wMy0xMFQwMjo0ODowM1oifQ\"\n }\n ]\n}", - "Content-Type" : "application/vnd.docker.distribution.manifest.v1+prettyjws" + "X-Ms-Request-Id" : "44ab8b4d-8da6-48db-8a34-9402cebdb956", + "X-Ms-Client-Request-Id" : "afe8ba9d-6687-45f0-88fa-43094c54edfc", + "Etag" : "\"sha256:ffb13da98453e0f04d33a6eee5bb8e46ee50d08ebe17735fc0779d0349e889e9\"", + "Content-Length" : "2561", + "Body" : "{\"manifests\":[{\"digest\":\"sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"amd64\",\"os\":\"linux\"},\"size\":525},{\"digest\":\"sha256:6253ef1af25aabd67777a01c686e7c69ee612961db34c8b90da079e5473be83b\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"arm\",\"os\":\"linux\",\"variant\":\"v5\"},\"size\":525},{\"digest\":\"sha256:40d0cfd0861719208ff9f7747ab3f97844eeca509df705db44a736df863b76af\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"arm\",\"os\":\"linux\",\"variant\":\"v7\"},\"size\":525},{\"digest\":\"sha256:432f982638b3aefab73cc58ab28f5c16e96fdb504e8c134fc58dff4bae8bf338\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"arm64\",\"os\":\"linux\",\"variant\":\"v8\"},\"size\":525},{\"digest\":\"sha256:995efde2e81b21d1ea7066aa77a59298a62a9e9fbb4b77f36c189774ec9b1089\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"386\",\"os\":\"linux\"},\"size\":525},{\"digest\":\"sha256:eb11b1a194ff8e236a01eff392c4e1296a53b0fb4780d8b0382f7996a15d5392\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"mips64le\",\"os\":\"linux\"},\"size\":525},{\"digest\":\"sha256:3209b9aec056b296ea55b2af7757d078bf92e55a3ea29c5fdef5c785bcef09c4\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"ppc64le\",\"os\":\"linux\"},\"size\":525},{\"digest\":\"sha256:98c9722322be649df94780d3fbe594fce7996234b259f27eac9428b84050c849\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"riscv64\",\"os\":\"linux\"},\"size\":525},{\"digest\":\"sha256:c7b6944911848ce39b44ed660d95fb54d69bbd531de724c7ce6fc9f743c0b861\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"s390x\",\"os\":\"linux\"},\"size\":525},{\"digest\":\"sha256:f5094c800af671abfc125480b44bd223bdb54d0d2b065de6f9f8e9cdf25dead8\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"amd64\",\"os\":\"windows\",\"os.version\":\"10.0.20348.1607\"},\"size\":946},{\"digest\":\"sha256:222fd58970d97d818081fee49fa57821d0acad88697639692e5cd0bd26f9f174\",\"mediaType\":\"application\\/vnd.docker.distribution.manifest.v2+json\",\"platform\":{\"architecture\":\"amd64\",\"os\":\"windows\",\"os.version\":\"10.0.17763.4131\"},\"size\":946}],\"mediaType\":\"application\\/vnd.docker.distribution.manifest.list.v2+json\",\"schemaVersion\":2}", + "Content-Type" : "application/vnd.docker.distribution.manifest.list.v2+json" }, "Exception" : null }, { "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "6a90219b-f33b-4fdd-8f66-1060eec5528f", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "920b1adb-abf7-4451-b6c1-96dbb0b4d3f8", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "b513b96d-45ac-4306-85e7-1e20a8e50aa9", + "X-Ms-Correlation-Request-Id" : "575f6bbb-bf82-4d92-9148-0e2d7a3840d8", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.483333", + "x-ms-ratelimit-remaining-calls-per-second" : "332.933333", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:03 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -96,8 +96,8 @@ "Method" : "DELETE", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/blobs/sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "55435448-edfc-4417-a47c-47acb788da02" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "d656dbc1-43b2-4667-9e18-dc969a5c04d0" }, "Response" : { "Server" : "openresty", @@ -105,14 +105,14 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Fri, 10 Mar 2023 02:48:03 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "8ae8e713-2299-4e34-b2cd-2f157798c0e0", + "X-Ms-Correlation-Request-Id" : "96aee582-d59a-4e36-b26b-297f4dfc3171", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "e3c35792-e296-4d96-9737-f60f4bd2fc93", - "X-Ms-Client-Request-Id" : "55435448-edfc-4417-a47c-47acb788da02", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "32.000000", + "X-Ms-Request-Id" : "4a20ee5a-53da-4f80-84de-823a7c86cb11", + "X-Ms-Client-Request-Id" : "d656dbc1-43b2-4667-9e18-dc969a5c04d0", + "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "31.000000", "Content-Length" : "74", "Body" : "{\"errors\":[{\"code\":\"BLOB_UNKNOWN\",\"message\":\"blob unknown to registry\"}]}\n", "Content-Type" : "application/json; charset=utf-8" @@ -122,21 +122,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "0dfdaa56-c6a7-46a7-be14-6208a4c94a89", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "8f560c21-7589-414a-84fa-572ffc34d812", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "9122084b-a2d1-4d4b-8adb-9d24f0ce8854", + "X-Ms-Correlation-Request-Id" : "45d59417-8537-42a8-aefe-bc7d68641d95", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.683333", + "x-ms-ratelimit-remaining-calls-per-second" : "333.15", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:03 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -144,8 +144,8 @@ "Method" : "DELETE", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/blobs/sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "ca7e2887-be18-4339-a55a-d3697fb75923" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "f5b7ecba-d79a-4422-b379-b0207a2bec67" }, "Response" : { "Server" : "openresty", @@ -153,13 +153,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Fri, 10 Mar 2023 02:48:04 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "a449906d-8ad5-4c9d-866d-e2d5df9d9727", + "X-Ms-Correlation-Request-Id" : "ccaaa875-72ee-4243-8573-6f7450a63f00", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "a17c63bb-4882-4aa2-a147-3dc86cf902bc", - "X-Ms-Client-Request-Id" : "ca7e2887-be18-4339-a55a-d3697fb75923", + "X-Ms-Request-Id" : "5f4b7038-a19d-4487-8312-88d5021dcd44", + "X-Ms-Client-Request-Id" : "f5b7ecba-d79a-4422-b379-b0207a2bec67", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "31.000000", "Content-Length" : "74", "Body" : "{\"errors\":[{\"code\":\"BLOB_UNKNOWN\",\"message\":\"blob unknown to registry\"}]}\n", @@ -170,21 +170,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "441606b1-1a08-4098-856d-e213782e299e", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "2e80c676-54be-45db-b253-fe3119519d69", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "db5ea192-83cf-409a-b931-cff02c297dab", + "X-Ms-Correlation-Request-Id" : "484ffd8c-ff4a-4f83-aa66-5b47129ca018", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "332.55", + "x-ms-ratelimit-remaining-calls-per-second" : "333", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:04 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -192,8 +192,8 @@ "Method" : "DELETE", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "3e5ae895-edd3-4079-9324-3dc2d35f020f" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "dd588e13-8abb-43aa-a5d2-4071a4ea8f91" }, "Response" : { "Server" : "openresty", @@ -201,13 +201,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Fri, 10 Mar 2023 02:48:04 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:07 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "90d98758-7171-4e2c-b555-52eb9f8b058b", + "X-Ms-Correlation-Request-Id" : "4f894798-3756-4352-bb87-e85bbc2c41b5", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "2e86cbfc-4bbb-46d5-96cb-0f0f6439aad1", - "X-Ms-Client-Request-Id" : "3e5ae895-edd3-4079-9324-3dc2d35f020f", + "X-Ms-Request-Id" : "7ebf01a3-503c-4a49-90d5-11ee1fc3ae9d", + "X-Ms-Client-Request-Id" : "dd588e13-8abb-43aa-a5d2-4071a4ea8f91", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "30.000000", "Content-Length" : "147", "Body" : "{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598 is not found\"}]}\n", @@ -216,4 +216,4 @@ "Exception" : null } ], "variables" : [ ] -} +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestDifferentType[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestIncompatibleType[1].json similarity index 54% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestDifferentType[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestIncompatibleType[1].json index 760a71ec8890a..aeb072118b604 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestDifferentType[1].json +++ b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestIncompatibleType[1].json @@ -3,21 +3,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/exchange?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "8a11bd46-e7c4-46f5-9d22-2fe269717299", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "f68ff002-13c6-48ae-8b96-4121f447ed5b", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "92bb10bb-2a5c-4eb5-a712-28250e05663c", + "X-Ms-Correlation-Request-Id" : "2eee301a-67e6-48b6-b839-ad872b14e869", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.183333", + "x-ms-ratelimit-remaining-calls-per-second" : "332.983333", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"refresh_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:47:59 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -25,70 +25,116 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "e078ba2d-3489-494d-970d-fdbe008237bf", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "f10a862f-de75-4337-b0e7-e85feb33e490", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "6262bdc9-b9e7-4a76-b9c6-09ae1fe66d02", + "X-Ms-Correlation-Request-Id" : "df8d68e5-ea7b-4dba-9fc9-7d6012374037", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.016667", + "x-ms-ratelimit-remaining-calls-per-second" : "333.1", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:47:59 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null }, { - "Method" : "GET", - "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/manifests/latest", + "Method" : "PUT", + "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/manifests/sha256:5a68d6d4e86b52b9bacc57847167c33a9c90f54924d2538ef2a75281c94a7bcc", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d216e8a6-6340-4d85-92f1-baf0a1796a4d" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "78610bdb-5d44-434d-a4b2-253eb0759df1", + "Content-Type" : "application/vnd.oci.artifact.manifest.v1+json" }, "Response" : { "Server" : "openresty", "X-Content-Type-Options" : "nosniff", "Connection" : "keep-alive", "retry-after" : "0", + "StatusCode" : "201", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", + "Docker-Content-Digest" : "sha256:5a68d6d4e86b52b9bacc57847167c33a9c90f54924d2538ef2a75281c94a7bcc", + "Docker-Distribution-Api-Version" : "registry/2.0", + "X-Ms-Correlation-Request-Id" : "335143d9-ced4-47f0-a1fb-54a6272e14fd", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", + "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", + "X-Ms-Request-Id" : "a4d1b5e7-4ea7-4d02-aa68-11efb71912e6", + "X-Ms-Client-Request-Id" : "78610bdb-5d44-434d-a4b2-253eb0759df1", + "Content-Length" : "0", + "Location" : "/v2/library/hello-world/manifests/sha256:5a68d6d4e86b52b9bacc57847167c33a9c90f54924d2538ef2a75281c94a7bcc" + }, + "Exception" : null + }, { + "Method" : "POST", + "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", + "Headers" : { + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "a65a99b7-d948-4fbc-a0e7-6c4e263d0f8c", + "Content-Type" : "application/x-www-form-urlencoded" + }, + "Response" : { + "Transfer-Encoding" : "chunked", + "X-Ms-Correlation-Request-Id" : "aa66ab74-6d2a-4ee4-83be-d30aa4aae4b1", + "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", + "Server" : "openresty", + "x-ms-ratelimit-remaining-calls-per-second" : "332.966667", + "Connection" : "keep-alive", + "retry-after" : "0", "StatusCode" : "200", - "Date" : "Fri, 10 Mar 2023 02:47:59 GMT", - "Docker-Content-Digest" : "sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4", + "Body" : "{\"access_token\":\"REDACTED\"}", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", + "Content-Type" : "application/json; charset=utf-8" + }, + "Exception" : null + }, { + "Method" : "GET", + "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/manifests/sha256:5a68d6d4e86b52b9bacc57847167c33a9c90f54924d2538ef2a75281c94a7bcc", + "Headers" : { + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "6edad209-78a5-4610-a3f6-d04903a1090d" + }, + "Response" : { + "Server" : "openresty", + "X-Content-Type-Options" : "nosniff", + "Connection" : "keep-alive", + "retry-after" : "0", + "StatusCode" : "404", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "b96bdded-02ba-4c72-b10e-7eb0367eaf65", + "X-Ms-Correlation-Request-Id" : "41706b35-2e7a-44f9-a363-76350d85d14a", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "0768cbf9-b60e-49c9-9693-1d9bac941786", - "X-Ms-Client-Request-Id" : "d216e8a6-6340-4d85-92f1-baf0a1796a4d", - "Etag" : "\"sha256:f54a58bc1aac5ea1a25d796ae155dc228b3f0e11d046ae276b39c4bf2f13d8c4\"", - "Content-Length" : "525", - "Body" : "{\n \"schemaVersion\": 2,\n \"mediaType\": \"application/vnd.docker.distribution.manifest.v2+json\",\n \"config\": {\n \"mediaType\": \"application/vnd.docker.container.image.v1+json\",\n \"size\": 1469,\n \"digest\": \"sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412\"\n },\n \"layers\": [\n {\n \"mediaType\": \"application/vnd.docker.image.rootfs.diff.tar.gzip\",\n \"size\": 2479,\n \"digest\": \"sha256:2db29710123e3e53a794f2694094b9b4338aa9ee5c40b930cb8063a1be392c54\"\n }\n ]\n}", - "Content-Type" : "application/vnd.docker.distribution.manifest.v2+json" + "X-Ms-Request-Id" : "bb2d9ddc-eeff-413c-b8f6-d54995be981f", + "X-Ms-Client-Request-Id" : "6edad209-78a5-4610-a3f6-d04903a1090d", + "Content-Length" : "122", + "Body" : "{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"OCI artifact found, but accept header does not support OCI artifacts\"}]}\n", + "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null }, { "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "5e0ee615-475c-4c45-8e45-0cfa0b14feaa", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "3df85ca5-9d1b-413c-b861-fc846d77026f", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "89cf1565-2d6c-4516-9a13-a9347cffb914", + "X-Ms-Correlation-Request-Id" : "4e7d6b4b-caac-4fec-b70d-5a56889faba9", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.166667", + "x-ms-ratelimit-remaining-calls-per-second" : "332.95", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:47:59 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -96,8 +142,8 @@ "Method" : "DELETE", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/blobs/sha256:44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d8c44aba-013a-406d-8830-0eb4189b98b0" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "1acaebd3-f45c-4f23-b2cc-6bf0a9fb4fbe" }, "Response" : { "Server" : "openresty", @@ -105,14 +151,14 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Fri, 10 Mar 2023 02:48:00 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "9daee987-ea50-427b-8937-295161dd2c61", + "X-Ms-Correlation-Request-Id" : "fdef5dce-78fc-4a74-996e-9ab537ef306f", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "58fb4c5f-cf4a-40b0-a4dd-b1d5b29f7354", - "X-Ms-Client-Request-Id" : "d8c44aba-013a-406d-8830-0eb4189b98b0", - "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "32.000000", + "X-Ms-Request-Id" : "4d4c828f-2edc-4f73-ad51-ec1b29572a46", + "X-Ms-Client-Request-Id" : "1acaebd3-f45c-4f23-b2cc-6bf0a9fb4fbe", + "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "30.000000", "Content-Length" : "74", "Body" : "{\"errors\":[{\"code\":\"BLOB_UNKNOWN\",\"message\":\"blob unknown to registry\"}]}\n", "Content-Type" : "application/json; charset=utf-8" @@ -122,21 +168,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "00d7eaa6-9015-47f0-b191-bfb1edc212ae", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "a30464d3-904b-438e-91bf-57621c144237", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "cacbbeb4-297a-4a48-8ad6-98a38f93168b", + "X-Ms-Correlation-Request-Id" : "c90110f2-78af-4207-b059-a248d159821b", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.233333", + "x-ms-ratelimit-remaining-calls-per-second" : "333.083333", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:00 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -144,8 +190,8 @@ "Method" : "DELETE", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/blobs/sha256:b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "1b7c9a70-633a-48a1-abad-46bdce8acc83" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "754dffea-1b07-473c-a810-bda1fafd2cc5" }, "Response" : { "Server" : "openresty", @@ -153,13 +199,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Fri, 10 Mar 2023 02:48:00 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:08 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "9b077fe2-5254-412e-8fac-2a0cb27c252f", + "X-Ms-Correlation-Request-Id" : "7dde6e19-b1b6-4b48-902b-69d8f6e0c8da", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "37a3bc5d-cc3e-4488-8228-083cf7d4c41c", - "X-Ms-Client-Request-Id" : "1b7c9a70-633a-48a1-abad-46bdce8acc83", + "X-Ms-Request-Id" : "998c66a9-01c6-411c-843a-420190d3689b", + "X-Ms-Client-Request-Id" : "754dffea-1b07-473c-a810-bda1fafd2cc5", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "31.000000", "Content-Length" : "74", "Body" : "{\"errors\":[{\"code\":\"BLOB_UNKNOWN\",\"message\":\"blob unknown to registry\"}]}\n", @@ -170,21 +216,21 @@ "Method" : "POST", "Uri" : "https://REDACTED.azurecr.io/oauth2/token?api-version=2021-07-01", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "d5ad7354-bedc-4709-a72a-e614f87787a8", + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "515459c7-1698-4598-95fb-1778c046681c", "Content-Type" : "application/x-www-form-urlencoded" }, "Response" : { "Transfer-Encoding" : "chunked", - "X-Ms-Correlation-Request-Id" : "6d56bde8-aa50-4c2c-9189-394393867ec1", + "X-Ms-Correlation-Request-Id" : "380c2a03-9517-4bce-8b73-ddb842ace463", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains", "Server" : "openresty", - "x-ms-ratelimit-remaining-calls-per-second" : "333.15", + "x-ms-ratelimit-remaining-calls-per-second" : "332.883333", "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "200", "Body" : "{\"access_token\":\"REDACTED\"}", - "Date" : "Fri, 10 Mar 2023 02:48:00 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:09 GMT", "Content-Type" : "application/json; charset=utf-8" }, "Exception" : null @@ -192,8 +238,8 @@ "Method" : "DELETE", "Uri" : "https://REDACTED.azurecr.io/v2/library%2Fhello-world/manifests/sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598", "Headers" : { - "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.3 (17.0.4; Windows 11; 10.0)", - "x-ms-client-request-id" : "b84ac7c0-0e52-46ed-bdcc-954589a54949" + "User-Agent" : "azsdk-java-azure-containers-containerregistry/1.1.0-beta.4 (17.0.4; Windows 11; 10.0)", + "x-ms-client-request-id" : "4e952a5b-ba64-4ab5-b280-25f111efff66" }, "Response" : { "Server" : "openresty", @@ -201,13 +247,13 @@ "Connection" : "keep-alive", "retry-after" : "0", "StatusCode" : "404", - "Date" : "Fri, 10 Mar 2023 02:48:00 GMT", + "Date" : "Thu, 16 Mar 2023 21:47:09 GMT", "Docker-Distribution-Api-Version" : "registry/2.0", - "X-Ms-Correlation-Request-Id" : "27724596-cbde-4ccc-ba91-0cf39226757a", + "X-Ms-Correlation-Request-Id" : "1440205c-368a-4b50-a769-b5b44bf13950", "Strict-Transport-Security" : "max-age=31536000; includeSubDomains,max-age=31536000; includeSubDomains", "Access-Control-Expose-Headers" : "Docker-Content-Digest,WWW-Authenticate,Link,X-Ms-Correlation-Request-Id", - "X-Ms-Request-Id" : "07386422-72de-4dd4-bcf5-f5dc33e35ba2", - "X-Ms-Client-Request-Id" : "b84ac7c0-0e52-46ed-bdcc-954589a54949", + "X-Ms-Request-Id" : "ae7ef82d-9220-40d0-a5f9-2bce00aace28", + "X-Ms-Client-Request-Id" : "4e952a5b-ba64-4ab5-b280-25f111efff66", "X-Ms-Ratelimit-Remaining-Calls-Per-Second" : "30.000000", "Content-Length" : "147", "Body" : "{\"errors\":[{\"code\":\"MANIFEST_UNKNOWN\",\"message\":\"manifest sha256:492bc88863bdf51159c4efe84e851c48d7034881159b56c4338003e50e801598 is not found\"}]}\n", @@ -216,4 +262,4 @@ "Exception" : null } ], "variables" : [ ] -} +} \ No newline at end of file diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestListManifestAsync[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestListManifestAsync[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestListManifestAsync[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestListManifestAsync[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestListManifest[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestListManifest[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifestListManifest[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifestListManifest[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifest[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifest[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.downloadManifest[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.getManifest[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.uploadManifest[1].json b/sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.setManifest[1].json similarity index 100% rename from sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryBlobClientIntegrationTests.uploadManifest[1].json rename to sdk/containerregistry/azure-containers-containerregistry/src/test/resources/session-records/ContainerRegistryContentClientIntegrationTests.setManifest[1].json diff --git a/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md b/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md index ff5c12ebf4c89..d34871b719c52 100644 --- a/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md +++ b/sdk/containerregistry/azure-containers-containerregistry/swagger/autorest.md @@ -96,6 +96,15 @@ directive: $["x-ms-enum"].modelAsString = true; ``` +### Remove "Authentication_GetAcrAccessTokenFromLogin" operation as the service team discourage using username/password to authenticate. +```yaml +directive: + - from: swagger-document + where: $["paths"]["/oauth2/token"] + transform: > + delete $.get +``` + ### Update the field names for RepositoryChangeableAttributes ```yaml directive: @@ -163,6 +172,9 @@ directive: ``` ### Set readonly flag to properties of TagAttributesBase + + + ```yaml directive: - from: swagger-document @@ -176,6 +188,9 @@ directive: ``` ### Update the field names for TagChangeableAttributes + + + ```yaml directive: - from: swagger-document @@ -186,6 +201,7 @@ directive: $["properties"]["listEnabled"]["x-ms-client-name"] = "listEnabled"; $["properties"]["readEnabled"]["x-ms-client-name"] = "readEnabled"; ``` + # Add content-type parameter ```yaml directive: @@ -230,10 +246,10 @@ directive: delete $["x-accessibility"]; delete $["allOf"]; $.properties["schemaVersion"] = { - "type": "integer", - "description": "Schema version", - "x-ms-client-default": 2 - }; + "type": "integer", + "description": "Schema version" + }; + $.properties.config["x-ms-client-name"] = "configuration"; ``` # Take stream as manifest body @@ -248,7 +264,10 @@ directive: } ``` -# Replace ManifestWrapper with stream response to calculate MD5 +# Replace ManifestWrapper with stream response to calculate SHA256 + + + ```yaml directive: from: swagger-document @@ -257,7 +276,7 @@ directive: $.schema = { "type": "string", "format": "binary" - } + }; ``` # Rename ArtifactBlobDescriptor to OciDescriptor @@ -280,3 +299,27 @@ directive: $["x-ms-client-name"] = "OciAnnotations"; delete $["x-accessibility"] ``` + +# Rename created to createdOn in OciAnnotations +```yaml +directive: + from: swagger-document + where: $.definitions.Annotations + transform: > + $.properties["org.opencontainers.image.created"] = { + "description": "Date and time on which the image was built (string, date-time as defined by https://tools.ietf.org/html/rfc3339#section-5.6)", + "type": "string", + "format": "date-time", + "x-ms-client-name": "CreatedOn" + }; +``` + +# Remove security definitions +``` yaml +directive: +- from: swagger-document + where: $. + transform: > + delete $["securityDefinitions"]; + delete $["security"]; +``` diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/CHANGELOG.md b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/CHANGELOG.md new file mode 100644 index 0000000000000..2f3eaf19ab37c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/CHANGELOG.md @@ -0,0 +1,15 @@ +# Release History + +## 1.0.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 1.0.0-beta.1 (2023-03-27) + +- Azure Resource Manager NewRelicObservability client library for Java. This package contains Microsoft Azure SDK for NewRelicObservability Management SDK. Package tag package-2022-07-01-preview. 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/newrelicobservability/azure-resourcemanager-newrelicobservability/README.md b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/README.md new file mode 100644 index 0000000000000..262df73c45869 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager NewRelicObservability client library for Java + +Azure Resource Manager NewRelicObservability client library for Java. + +This package contains Microsoft Azure SDK for NewRelicObservability Management SDK. Package tag package-2022-07-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-newrelicobservability + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the 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 `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +NewRelicObservabilityManager manager = NewRelicObservabilityManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/SAMPLE.md b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/SAMPLE.md new file mode 100644 index 0000000000000..b736dbce1080d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/SAMPLE.md @@ -0,0 +1,1075 @@ +# Code snippets and samples + + +## Accounts + +- [List](#accounts_list) + +## Monitors + +- [CreateOrUpdate](#monitors_createorupdate) +- [Delete](#monitors_delete) +- [GetByResourceGroup](#monitors_getbyresourcegroup) +- [GetMetricRules](#monitors_getmetricrules) +- [GetMetricStatus](#monitors_getmetricstatus) +- [List](#monitors_list) +- [ListAppServices](#monitors_listappservices) +- [ListByResourceGroup](#monitors_listbyresourcegroup) +- [ListHosts](#monitors_listhosts) +- [ListMonitoredResources](#monitors_listmonitoredresources) +- [SwitchBilling](#monitors_switchbilling) +- [Update](#monitors_update) +- [VmHostPayload](#monitors_vmhostpayload) + +## Operations + +- [List](#operations_list) + +## Organizations + +- [List](#organizations_list) + +## Plans + +- [List](#plans_list) + +## TagRules + +- [CreateOrUpdate](#tagrules_createorupdate) +- [Delete](#tagrules_delete) +- [Get](#tagrules_get) +- [ListByNewRelicMonitorResource](#tagrules_listbynewrelicmonitorresource) +- [Update](#tagrules_update) +### Accounts_List + +```java +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void accountsListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void accountsListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_CreateOrUpdate + +```java +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.AccountInfo; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationInfo; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors CreateOrUpdate. */ +public final class MonitorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .define("cdlymktqw") + .withRegion("k") + .withExistingResourceGroup("rgNewRelic") + .withTags(mapOf("key6976", "oaxfhf")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Monitors_Delete + +```java +/** Samples for Monitors Delete. */ +public final class MonitorsDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsDeleteMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().delete("rgopenapi", null, "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsDeleteMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .delete( + "rgopenapi", + "ruxvg@xqkmdhrnoo.hlmbpm", + "ipxmlcbonyxtolzejcjshkmlron", + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_GetByResourceGroup + +```java +/** Samples for Monitors GetByResourceGroup. */ +public final class MonitorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_GetMetricRules + +```java +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; + +/** Samples for Monitors GetMetricRules. */ +public final class MonitorsGetMetricRulesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricRulesMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricRulesMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_GetMetricStatus + +```java +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import java.util.Arrays; + +/** Samples for Monitors GetMetricStatus. */ +public final class MonitorsGetMetricStatusSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricStatusMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricStatusMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest() + .withAzureResourceIds(Arrays.asList("enfghpfw")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_List + +```java +/** Samples for Monitors List. */ +public final class MonitorsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListAppServices + +```java +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListAppServices. */ +public final class MonitorsListAppServicesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListAppServicesMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest() + .withAzureResourceIds(Arrays.asList("pvzrksrmzowobuhxpwiotnpcvjbu")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListAppServicesMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListByResourceGroup + +```java +/** Samples for Monitors ListByResourceGroup. */ +public final class MonitorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().listByResourceGroup("rgNewRelic", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListHosts + +```java +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListHosts. */ +public final class MonitorsListHostsSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListHostsMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListHostsMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_ListMonitoredResources + +```java +/** Samples for Monitors ListMonitoredResources. */ +public final class MonitorsListMonitoredResourcesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListMonitoredResourcesMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListMonitoredResourcesMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_SwitchBilling + +```java +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.time.OffsetDateTime; + +/** Samples for Monitors SwitchBilling. */ +public final class MonitorsSwitchBillingSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsSwitchBillingMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsSwitchBillingMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest() + .withAzureResourceId("enfghpfw") + .withOrganizationId("k") + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Monitors_Update + +```java +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.AccountInfo; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationInfo; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Update. */ +public final class MonitorsUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + NewRelicMonitorResource resource = + manager + .monitors() + .getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key164", "jqakdrrmmyzytqu")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Monitors_VmHostPayload + +```java +/** Samples for Monitors VmHostPayload. */ +public final class MonitorsVmHostPayloadSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsVmHostPayloadMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsVmHostPayloadMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void operationsListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void operationsListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Organizations_List + +```java +/** Samples for Organizations List. */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void organizationsListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void organizationsListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} +``` + +### Plans_List + +```java +/** Samples for Plans List. */ +public final class PlansListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void plansListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.plans().list("pwuxgvrmkk", "hilawwjz", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ + /** + * Sample code: Plans_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void plansListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.plans().list(null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.util.Arrays; + +/** Samples for TagRules CreateOrUpdate. */ +public final class TagRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .create(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesCreateOrUpdateMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .create(); + } +} +``` + +### TagRules_Delete + +```java +/** Samples for TagRules Delete. */ +public final class TagRulesDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesDeleteMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesDeleteMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_Get + +```java +/** Samples for TagRules Get. */ +public final class TagRulesGetSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesGetMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesGetMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_ListByNewRelicMonitorResource + +```java +/** Samples for TagRules ListByNewRelicMonitorResource. */ +public final class TagRulesListByNewRelicMonitorResourceSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} +``` + +### TagRules_Update + +```java +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; +import java.util.Arrays; + +/** Samples for TagRules Update. */ +public final class TagRulesUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .apply(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesUpdateMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml new file mode 100644 index 0000000000000..87a1f4e33bb33 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml @@ -0,0 +1,97 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-newrelicobservability + 1.0.0-beta.2 + jar + + Microsoft Azure SDK for NewRelicObservability Management + This package contains Microsoft Azure SDK for NewRelicObservability Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2022-07-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + + + + com.azure + azure-core + 1.37.0 + + + com.azure + azure-core-management + 1.10.2 + + + com.azure + azure-core-test + 1.15.0 + test + + + com.azure + azure-identity + 1.8.1 + test + + + org.junit.jupiter + junit-jupiter-api + 5.9.1 + test + + + org.junit.jupiter + junit-jupiter-engine + 5.9.1 + test + + + org.mockito + mockito-core + 4.5.1 + test + + + org.slf4j + slf4j-simple + 1.7.36 + test + + + diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/NewRelicObservabilityManager.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/NewRelicObservabilityManager.java new file mode 100644 index 0000000000000..c9d6e1fa454e4 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/NewRelicObservabilityManager.java @@ -0,0 +1,363 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.NewRelicObservability; +import com.azure.resourcemanager.newrelicobservability.implementation.AccountsImpl; +import com.azure.resourcemanager.newrelicobservability.implementation.MonitorsImpl; +import com.azure.resourcemanager.newrelicobservability.implementation.NewRelicObservabilityBuilder; +import com.azure.resourcemanager.newrelicobservability.implementation.OperationsImpl; +import com.azure.resourcemanager.newrelicobservability.implementation.OrganizationsImpl; +import com.azure.resourcemanager.newrelicobservability.implementation.PlansImpl; +import com.azure.resourcemanager.newrelicobservability.implementation.TagRulesImpl; +import com.azure.resourcemanager.newrelicobservability.models.Accounts; +import com.azure.resourcemanager.newrelicobservability.models.Monitors; +import com.azure.resourcemanager.newrelicobservability.models.Operations; +import com.azure.resourcemanager.newrelicobservability.models.Organizations; +import com.azure.resourcemanager.newrelicobservability.models.Plans; +import com.azure.resourcemanager.newrelicobservability.models.TagRules; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to NewRelicObservabilityManager. */ +public final class NewRelicObservabilityManager { + private Operations operations; + + private Accounts accounts; + + private Monitors monitors; + + private Organizations organizations; + + private Plans plans; + + private TagRules tagRules; + + private final NewRelicObservability clientObject; + + private NewRelicObservabilityManager( + HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new NewRelicObservabilityBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of NewRelicObservability service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the NewRelicObservability service API instance. + */ + public static NewRelicObservabilityManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of NewRelicObservability service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the NewRelicObservability service API instance. + */ + public static NewRelicObservabilityManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new NewRelicObservabilityManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create NewRelicObservabilityManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new NewRelicObservabilityManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of NewRelicObservability service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the NewRelicObservability service API instance. + */ + public NewRelicObservabilityManager 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.newrelicobservability") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new NewRelicObservabilityManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Accounts. + * + * @return Resource collection API of Accounts. + */ + public Accounts accounts() { + if (this.accounts == null) { + this.accounts = new AccountsImpl(clientObject.getAccounts(), this); + } + return accounts; + } + + /** + * Gets the resource collection API of Monitors. It manages NewRelicMonitorResource. + * + * @return Resource collection API of Monitors. + */ + public Monitors monitors() { + if (this.monitors == null) { + this.monitors = new MonitorsImpl(clientObject.getMonitors(), this); + } + return monitors; + } + + /** + * Gets the resource collection API of Organizations. + * + * @return Resource collection API of Organizations. + */ + public Organizations organizations() { + if (this.organizations == null) { + this.organizations = new OrganizationsImpl(clientObject.getOrganizations(), this); + } + return organizations; + } + + /** + * Gets the resource collection API of Plans. + * + * @return Resource collection API of Plans. + */ + public Plans plans() { + if (this.plans == null) { + this.plans = new PlansImpl(clientObject.getPlans(), this); + } + return plans; + } + + /** + * Gets the resource collection API of TagRules. It manages TagRule. + * + * @return Resource collection API of TagRules. + */ + public TagRules tagRules() { + if (this.tagRules == null) { + this.tagRules = new TagRulesImpl(clientObject.getTagRules(), this); + } + return tagRules; + } + + /** + * @return Wrapped service client NewRelicObservability providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public NewRelicObservability serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/AccountsClient.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/AccountsClient.java new file mode 100644 index 0000000000000..bebbcf51a9f01 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/AccountsClient.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.newrelicobservability.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public interface AccountsClient { + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location); + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/MonitorsClient.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/MonitorsClient.java new file mode 100644 index 0000000000000..2a5d1782353f2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/MonitorsClient.java @@ -0,0 +1,467 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; + +/** An instance of this class provides access to all the operations defined in MonitorsClient. */ +public interface MonitorsClient { + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource); + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context); + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties, Context context); + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NewRelicMonitorResourceInner update( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String userEmail, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String userEmail, String monitorName, Context context); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors 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 userEmail, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String userEmail, String monitorName, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricRulesInner getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricsStatusResponseInner getMetricStatus( + String resourceGroupName, String monitorName, MetricsStatusRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources(String resourceGroupName, String monitorName); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VMExtensionPayloadInner vmHostPayload(String resourceGroupName, String monitorName); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/NewRelicObservability.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/NewRelicObservability.java new file mode 100644 index 0000000000000..5057a6922bb54 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/NewRelicObservability.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for NewRelicObservability class. */ +public interface NewRelicObservability { + /** + * 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 AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + AccountsClient getAccounts(); + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + MonitorsClient getMonitors(); + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + OrganizationsClient getOrganizations(); + + /** + * Gets the PlansClient object to access its operations. + * + * @return the PlansClient object. + */ + PlansClient getPlans(); + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + TagRulesClient getTagRules(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/OperationsClient.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/OperationsClient.java new file mode 100644 index 0000000000000..030cebabc15ae --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/OperationsClient.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.newrelicobservability.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/OrganizationsClient.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/OrganizationsClient.java new file mode 100644 index 0000000000000..022c25a18cfe6 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/OrganizationsClient.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.newrelicobservability.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; + +/** An instance of this class provides access to all the operations defined in OrganizationsClient. */ +public interface OrganizationsClient { + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location); + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/PlansClient.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/PlansClient.java new file mode 100644 index 0000000000000..5fdc8edde21f2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/PlansClient.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.newrelicobservability.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; + +/** An instance of this class provides access to all the operations defined in PlansClient. */ +public interface PlansClient { + /** + * List plans data. + * + * @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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String accountId, String organizationId, Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/TagRulesClient.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/TagRulesClient.java new file mode 100644 index 0000000000000..b7d971519c4e7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/TagRulesClient.java @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner; + +/** An instance of this class provides access to all the operations defined in TagRulesClient. */ +public interface TagRulesClient { + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName); + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByNewRelicMonitorResource( + String resourceGroupName, String monitorName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner get(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource); + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @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 monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + TagRuleUpdateInner properties, + Context context); + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TagRuleInner update( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AccountProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AccountProperties.java new file mode 100644 index 0000000000000..fe7862b7a39e4 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AccountProperties.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.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** List of all the New relic accounts for the given user. */ +@Fluent +public final class AccountProperties { + /* + * organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * account id + */ + @JsonProperty(value = "accountId") + private String accountId; + + /* + * account name + */ + @JsonProperty(value = "accountName") + private String accountName; + + /* + * region + */ + @JsonProperty(value = "region") + private String region; + + /** Creates an instance of AccountProperties class. */ + public AccountProperties() { + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the accountId property: account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Set the accountId property: account id. + * + * @param accountId the accountId value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the accountName property: account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.accountName; + } + + /** + * Set the accountName property: account name. + * + * @param accountName the accountName value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withAccountName(String accountName) { + this.accountName = accountName; + return this; + } + + /** + * Get the region property: region. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: region. + * + * @param region the region value to set. + * @return the AccountProperties object itself. + */ + public AccountProperties withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AccountResourceInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AccountResourceInner.java new file mode 100644 index 0000000000000..1ed1f744a4001 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AccountResourceInner.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a account resource. */ +@Fluent +public final class AccountResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private AccountProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of AccountResourceInner class. */ + public AccountResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private AccountProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.innerProperties() == null ? null : this.innerProperties().organizationId(); + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withOrganizationId(String organizationId) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withOrganizationId(organizationId); + return this; + } + + /** + * Get the accountId property: account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.innerProperties() == null ? null : this.innerProperties().accountId(); + } + + /** + * Set the accountId property: account id. + * + * @param accountId the accountId value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withAccountId(String accountId) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withAccountId(accountId); + return this; + } + + /** + * Get the accountName property: account name. + * + * @return the accountName value. + */ + public String accountName() { + return this.innerProperties() == null ? null : this.innerProperties().accountName(); + } + + /** + * Set the accountName property: account name. + * + * @param accountName the accountName value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withAccountName(String accountName) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withAccountName(accountName); + return this; + } + + /** + * Get the region property: region. + * + * @return the region value. + */ + public String region() { + return this.innerProperties() == null ? null : this.innerProperties().region(); + } + + /** + * Set the region property: region. + * + * @param region the region value to set. + * @return the AccountResourceInner object itself. + */ + public AccountResourceInner withRegion(String region) { + if (this.innerProperties() == null) { + this.innerProperties = new AccountProperties(); + } + this.innerProperties().withRegion(region); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AppServiceInfoInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AppServiceInfoInner.java new file mode 100644 index 0000000000000..a06da081e1979 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/AppServiceInfoInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of VM Resource having NewRelic OneAgent installed. */ +@Fluent +public final class AppServiceInfoInner { + /* + * Azure App service resource ID + */ + @JsonProperty(value = "azureResourceId") + private String azureResourceId; + + /* + * Version of the NewRelic agent installed on the App service. + */ + @JsonProperty(value = "agentVersion") + private String agentVersion; + + /* + * Status of the NewRelic agent installed on the App service. + */ + @JsonProperty(value = "agentStatus") + private String agentStatus; + + /** Creates an instance of AppServiceInfoInner class. */ + public AppServiceInfoInner() { + } + + /** + * Get the azureResourceId property: Azure App service resource ID. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: Azure App service resource ID. + * + * @param azureResourceId the azureResourceId value to set. + * @return the AppServiceInfoInner object itself. + */ + public AppServiceInfoInner withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the agentVersion property: Version of the NewRelic agent installed on the App service. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Set the agentVersion property: Version of the NewRelic agent installed on the App service. + * + * @param agentVersion the agentVersion value to set. + * @return the AppServiceInfoInner object itself. + */ + public AppServiceInfoInner withAgentVersion(String agentVersion) { + this.agentVersion = agentVersion; + return this; + } + + /** + * Get the agentStatus property: Status of the NewRelic agent installed on the App service. + * + * @return the agentStatus value. + */ + public String agentStatus() { + return this.agentStatus; + } + + /** + * Set the agentStatus property: Status of the NewRelic agent installed on the App service. + * + * @param agentStatus the agentStatus value to set. + * @return the AppServiceInfoInner object itself. + */ + public AppServiceInfoInner withAgentStatus(String agentStatus) { + this.agentStatus = agentStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MetricRulesInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MetricRulesInner.java new file mode 100644 index 0000000000000..48c67894582cf --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MetricRulesInner.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.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Set of rules for sending metrics for the Monitor resource. */ +@Fluent +public final class MetricRulesInner { + /* + * Flag specifying if metrics should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendMetrics") + private SendMetricsStatus sendMetrics; + + /* + * List of filtering tags to be used for capturing metrics. + */ + @JsonProperty(value = "filteringTags") + private List filteringTags; + + /* + * User Email + */ + @JsonProperty(value = "userEmail") + private String userEmail; + + /** Creates an instance of MetricRulesInner class. */ + public MetricRulesInner() { + } + + /** + * Get the sendMetrics property: Flag specifying if metrics should be sent for the Monitor resource. + * + * @return the sendMetrics value. + */ + public SendMetricsStatus sendMetrics() { + return this.sendMetrics; + } + + /** + * Set the sendMetrics property: Flag specifying if metrics should be sent for the Monitor resource. + * + * @param sendMetrics the sendMetrics value to set. + * @return the MetricRulesInner object itself. + */ + public MetricRulesInner withSendMetrics(SendMetricsStatus sendMetrics) { + this.sendMetrics = sendMetrics; + return this; + } + + /** + * Get the filteringTags property: List of filtering tags to be used for capturing metrics. + * + * @return the filteringTags value. + */ + public List filteringTags() { + return this.filteringTags; + } + + /** + * Set the filteringTags property: List of filtering tags to be used for capturing metrics. + * + * @param filteringTags the filteringTags value to set. + * @return the MetricRulesInner object itself. + */ + public MetricRulesInner withFilteringTags(List filteringTags) { + this.filteringTags = filteringTags; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the MetricRulesInner object itself. + */ + public MetricRulesInner withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filteringTags() != null) { + filteringTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MetricsStatusResponseInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MetricsStatusResponseInner.java new file mode 100644 index 0000000000000..56ae936dc2f12 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MetricsStatusResponseInner.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.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get metrics status Operation. */ +@Fluent +public final class MetricsStatusResponseInner { + /* + * Azure resource IDs + */ + @JsonProperty(value = "azureResourceIds") + private List azureResourceIds; + + /** Creates an instance of MetricsStatusResponseInner class. */ + public MetricsStatusResponseInner() { + } + + /** + * Get the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + public List azureResourceIds() { + return this.azureResourceIds; + } + + /** + * Set the azureResourceIds property: Azure resource IDs. + * + * @param azureResourceIds the azureResourceIds value to set. + * @return the MetricsStatusResponseInner object itself. + */ + public MetricsStatusResponseInner withAzureResourceIds(List azureResourceIds) { + this.azureResourceIds = azureResourceIds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitorProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitorProperties.java new file mode 100644 index 0000000000000..cfad9ad1adfe3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitorProperties.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.LiftrResourceCategories; +import com.azure.resourcemanager.newrelicobservability.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.newrelicobservability.models.MonitoringStatus; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties specific to the NewRelic Monitor resource. */ +@Fluent +public final class MonitorProperties { + /* + * Provisioning State of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * MonitoringStatus of the resource + */ + @JsonProperty(value = "monitoringStatus", access = JsonProperty.Access.WRITE_ONLY) + private MonitoringStatus monitoringStatus; + + /* + * NewRelic Organization properties of the resource + */ + @JsonProperty(value = "marketplaceSubscriptionStatus", access = JsonProperty.Access.WRITE_ONLY) + private MarketplaceSubscriptionStatus marketplaceSubscriptionStatus; + + /* + * Marketplace Subscription Id + */ + @JsonProperty(value = "marketplaceSubscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String marketplaceSubscriptionId; + + /* + * MarketplaceSubscriptionStatus of the resource + */ + @JsonProperty(value = "newRelicAccountProperties") + private NewRelicAccountProperties newRelicAccountProperties; + + /* + * User Info + */ + @JsonProperty(value = "userInfo") + private UserInfo userInfo; + + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * Liftr resource category + */ + @JsonProperty(value = "liftrResourceCategory", access = JsonProperty.Access.WRITE_ONLY) + private LiftrResourceCategories liftrResourceCategory; + + /* + * Liftr resource preference. The priority of the resource. + */ + @JsonProperty(value = "liftrResourcePreference", access = JsonProperty.Access.WRITE_ONLY) + private Integer liftrResourcePreference; + + /* + * Source of org creation + */ + @JsonProperty(value = "orgCreationSource") + private OrgCreationSource orgCreationSource; + + /* + * Source of account creation + */ + @JsonProperty(value = "accountCreationSource") + private AccountCreationSource accountCreationSource; + + /** Creates an instance of MonitorProperties class. */ + public MonitorProperties() { + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the monitoringStatus property: MonitoringStatus of the resource. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.monitoringStatus; + } + + /** + * Get the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource. + * + * @return the marketplaceSubscriptionStatus value. + */ + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.marketplaceSubscriptionStatus; + } + + /** + * Get the marketplaceSubscriptionId property: Marketplace Subscription Id. + * + * @return the marketplaceSubscriptionId value. + */ + public String marketplaceSubscriptionId() { + return this.marketplaceSubscriptionId; + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.newRelicAccountProperties; + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties) { + this.newRelicAccountProperties = newRelicAccountProperties; + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the liftrResourceCategory property: Liftr resource category. + * + * @return the liftrResourceCategory value. + */ + public LiftrResourceCategories liftrResourceCategory() { + return this.liftrResourceCategory; + } + + /** + * Get the liftrResourcePreference property: Liftr resource preference. The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + public Integer liftrResourcePreference() { + return this.liftrResourcePreference; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.orgCreationSource; + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withOrgCreationSource(OrgCreationSource orgCreationSource) { + this.orgCreationSource = orgCreationSource; + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.accountCreationSource; + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the MonitorProperties object itself. + */ + public MonitorProperties withAccountCreationSource(AccountCreationSource accountCreationSource) { + this.accountCreationSource = accountCreationSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (newRelicAccountProperties() != null) { + newRelicAccountProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitoredResourceInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitoredResourceInner.java new file mode 100644 index 0000000000000..294cfd43a25ed --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitoredResourceInner.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.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendingMetricsStatus; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of resource being monitored by NewRelic monitor resource. */ +@Fluent +public final class MonitoredResourceInner { + /* + * The ARM id of the resource. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Flag indicating if resource is sending metrics to NewRelic. + */ + @JsonProperty(value = "sendingMetrics") + private SendingMetricsStatus sendingMetrics; + + /* + * Reason for why the resource is sending metrics (or why it is not sending). + */ + @JsonProperty(value = "reasonForMetricsStatus") + private String reasonForMetricsStatus; + + /* + * Flag indicating if resource is sending logs to NewRelic. + */ + @JsonProperty(value = "sendingLogs") + private SendingLogsStatus sendingLogs; + + /* + * Reason for why the resource is sending logs (or why it is not sending). + */ + @JsonProperty(value = "reasonForLogsStatus") + private String reasonForLogsStatus; + + /** Creates an instance of MonitoredResourceInner class. */ + public MonitoredResourceInner() { + } + + /** + * Get the id property: The ARM id of the resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ARM id of the resource. + * + * @param id the id value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the sendingMetrics property: Flag indicating if resource is sending metrics to NewRelic. + * + * @return the sendingMetrics value. + */ + public SendingMetricsStatus sendingMetrics() { + return this.sendingMetrics; + } + + /** + * Set the sendingMetrics property: Flag indicating if resource is sending metrics to NewRelic. + * + * @param sendingMetrics the sendingMetrics value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingMetrics(SendingMetricsStatus sendingMetrics) { + this.sendingMetrics = sendingMetrics; + return this; + } + + /** + * Get the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + public String reasonForMetricsStatus() { + return this.reasonForMetricsStatus; + } + + /** + * Set the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @param reasonForMetricsStatus the reasonForMetricsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForMetricsStatus(String reasonForMetricsStatus) { + this.reasonForMetricsStatus = reasonForMetricsStatus; + return this; + } + + /** + * Get the sendingLogs property: Flag indicating if resource is sending logs to NewRelic. + * + * @return the sendingLogs value. + */ + public SendingLogsStatus sendingLogs() { + return this.sendingLogs; + } + + /** + * Set the sendingLogs property: Flag indicating if resource is sending logs to NewRelic. + * + * @param sendingLogs the sendingLogs value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withSendingLogs(SendingLogsStatus sendingLogs) { + this.sendingLogs = sendingLogs; + return this; + } + + /** + * Get the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @return the reasonForLogsStatus value. + */ + public String reasonForLogsStatus() { + return this.reasonForLogsStatus; + } + + /** + * Set the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @param reasonForLogsStatus the reasonForLogsStatus value to set. + * @return the MonitoredResourceInner object itself. + */ + public MonitoredResourceInner withReasonForLogsStatus(String reasonForLogsStatus) { + this.reasonForLogsStatus = reasonForLogsStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitoringTagRulesPropertiesInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitoringTagRulesPropertiesInner.java new file mode 100644 index 0000000000000..d52542789b3f9 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/MonitoringTagRulesPropertiesInner.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The resource-specific properties for this resource. */ +@Fluent +public final class MonitoringTagRulesPropertiesInner { + /* + * Provisioning State of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Set of rules for sending logs for the Monitor resource. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /* + * Set of rules for sending metrics for the Monitor resource. + */ + @JsonProperty(value = "metricRules") + private MetricRulesInner metricRules; + + /** Creates an instance of MonitoringTagRulesPropertiesInner class. */ + public MonitoringTagRulesPropertiesInner() { + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the MonitoringTagRulesPropertiesInner object itself. + */ + public MonitoringTagRulesPropertiesInner withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.metricRules; + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the MonitoringTagRulesPropertiesInner object itself. + */ + public MonitoringTagRulesPropertiesInner withMetricRules(MetricRulesInner metricRules) { + this.metricRules = metricRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + if (metricRules() != null) { + metricRules().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/NewRelicMonitorResourceInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/NewRelicMonitorResourceInner.java new file mode 100644 index 0000000000000..54fbf990fbf46 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/NewRelicMonitorResourceInner.java @@ -0,0 +1,291 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.LiftrResourceCategories; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.newrelicobservability.models.MonitoringStatus; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A Monitor Resource by NewRelic. */ +@Fluent +public final class NewRelicMonitorResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties", required = true) + private MonitorProperties innerProperties = new MonitorProperties(); + + /* + * The managed service identities assigned to this resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of NewRelicMonitorResourceInner class. */ + public NewRelicMonitorResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private MonitorProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public NewRelicMonitorResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public NewRelicMonitorResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the monitoringStatus property: MonitoringStatus of the resource. + * + * @return the monitoringStatus value. + */ + public MonitoringStatus monitoringStatus() { + return this.innerProperties() == null ? null : this.innerProperties().monitoringStatus(); + } + + /** + * Get the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource. + * + * @return the marketplaceSubscriptionStatus value. + */ + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionStatus(); + } + + /** + * Get the marketplaceSubscriptionId property: Marketplace Subscription Id. + * + * @return the marketplaceSubscriptionId value. + */ + public String marketplaceSubscriptionId() { + return this.innerProperties() == null ? null : this.innerProperties().marketplaceSubscriptionId(); + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.innerProperties() == null ? null : this.innerProperties().newRelicAccountProperties(); + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.innerProperties() == null ? null : this.innerProperties().userInfo(); + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withUserInfo(UserInfo userInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withUserInfo(userInfo); + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.innerProperties() == null ? null : this.innerProperties().planData(); + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withPlanData(PlanData planData) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withPlanData(planData); + return this; + } + + /** + * Get the liftrResourceCategory property: Liftr resource category. + * + * @return the liftrResourceCategory value. + */ + public LiftrResourceCategories liftrResourceCategory() { + return this.innerProperties() == null ? null : this.innerProperties().liftrResourceCategory(); + } + + /** + * Get the liftrResourcePreference property: Liftr resource preference. The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + public Integer liftrResourcePreference() { + return this.innerProperties() == null ? null : this.innerProperties().liftrResourcePreference(); + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource(); + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withOrgCreationSource(orgCreationSource); + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource(); + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the NewRelicMonitorResourceInner object itself. + */ + public NewRelicMonitorResourceInner withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitorProperties(); + } + this.innerProperties().withAccountCreationSource(accountCreationSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model NewRelicMonitorResourceInner")); + } else { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NewRelicMonitorResourceInner.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/NewRelicMonitorResourceUpdateProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/NewRelicMonitorResourceUpdateProperties.java new file mode 100644 index 0000000000000..0d8d715951c77 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/NewRelicMonitorResourceUpdateProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the NewRelicMonitorResource. */ +@Fluent +public final class NewRelicMonitorResourceUpdateProperties { + /* + * MarketplaceSubscriptionStatus of the resource + */ + @JsonProperty(value = "newRelicAccountProperties") + private NewRelicAccountProperties newRelicAccountProperties; + + /* + * User Info + */ + @JsonProperty(value = "userInfo") + private UserInfo userInfo; + + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * Source of org creation + */ + @JsonProperty(value = "orgCreationSource") + private OrgCreationSource orgCreationSource; + + /* + * Source of account creation + */ + @JsonProperty(value = "accountCreationSource") + private AccountCreationSource accountCreationSource; + + /** Creates an instance of NewRelicMonitorResourceUpdateProperties class. */ + public NewRelicMonitorResourceUpdateProperties() { + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.newRelicAccountProperties; + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + this.newRelicAccountProperties = newRelicAccountProperties; + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.userInfo; + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withUserInfo(UserInfo userInfo) { + this.userInfo = userInfo; + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.orgCreationSource; + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withOrgCreationSource(OrgCreationSource orgCreationSource) { + this.orgCreationSource = orgCreationSource; + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.accountCreationSource; + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the NewRelicMonitorResourceUpdateProperties object itself. + */ + public NewRelicMonitorResourceUpdateProperties withAccountCreationSource( + AccountCreationSource accountCreationSource) { + this.accountCreationSource = accountCreationSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (newRelicAccountProperties() != null) { + newRelicAccountProperties().validate(); + } + if (userInfo() != null) { + userInfo().validate(); + } + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OperationInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..ea0884c17c93c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OperationInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.ActionType; +import com.azure.resourcemanager.newrelicobservability.models.OperationDisplay; +import com.azure.resourcemanager.newrelicobservability.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationInner class. */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OrganizationProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OrganizationProperties.java new file mode 100644 index 0000000000000..3aac3269f2783 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OrganizationProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of Organizations. */ +@Fluent +public final class OrganizationProperties { + /* + * organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * organization name + */ + @JsonProperty(value = "organizationName") + private String organizationName; + + /* + * Billing source + */ + @JsonProperty(value = "billingSource") + private BillingSource billingSource; + + /** Creates an instance of OrganizationProperties class. */ + public OrganizationProperties() { + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the organizationName property: organization name. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.organizationName; + } + + /** + * Set the organizationName property: organization name. + * + * @param organizationName the organizationName value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withOrganizationName(String organizationName) { + this.organizationName = organizationName; + return this; + } + + /** + * Get the billingSource property: Billing source. + * + * @return the billingSource value. + */ + public BillingSource billingSource() { + return this.billingSource; + } + + /** + * Set the billingSource property: Billing source. + * + * @param billingSource the billingSource value to set. + * @return the OrganizationProperties object itself. + */ + public OrganizationProperties withBillingSource(BillingSource billingSource) { + this.billingSource = billingSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OrganizationResourceInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OrganizationResourceInner.java new file mode 100644 index 0000000000000..e4c77069e6c21 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/OrganizationResourceInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a Organization resource. */ +@Fluent +public final class OrganizationResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private OrganizationProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of OrganizationResourceInner class. */ + public OrganizationResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private OrganizationProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the organizationId property: organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.innerProperties() == null ? null : this.innerProperties().organizationId(); + } + + /** + * Set the organizationId property: organization id. + * + * @param organizationId the organizationId value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withOrganizationId(String organizationId) { + if (this.innerProperties() == null) { + this.innerProperties = new OrganizationProperties(); + } + this.innerProperties().withOrganizationId(organizationId); + return this; + } + + /** + * Get the organizationName property: organization name. + * + * @return the organizationName value. + */ + public String organizationName() { + return this.innerProperties() == null ? null : this.innerProperties().organizationName(); + } + + /** + * Set the organizationName property: organization name. + * + * @param organizationName the organizationName value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withOrganizationName(String organizationName) { + if (this.innerProperties() == null) { + this.innerProperties = new OrganizationProperties(); + } + this.innerProperties().withOrganizationName(organizationName); + return this; + } + + /** + * Get the billingSource property: Billing source. + * + * @return the billingSource value. + */ + public BillingSource billingSource() { + return this.innerProperties() == null ? null : this.innerProperties().billingSource(); + } + + /** + * Set the billingSource property: Billing source. + * + * @param billingSource the billingSource value to set. + * @return the OrganizationResourceInner object itself. + */ + public OrganizationResourceInner withBillingSource(BillingSource billingSource) { + if (this.innerProperties() == null) { + this.innerProperties = new OrganizationProperties(); + } + this.innerProperties().withBillingSource(billingSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/PlanDataProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/PlanDataProperties.java new file mode 100644 index 0000000000000..b4ab5beb338a0 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/PlanDataProperties.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.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Plan details. */ +@Fluent +public final class PlanDataProperties { + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * Source of org creation + */ + @JsonProperty(value = "orgCreationSource") + private OrgCreationSource orgCreationSource; + + /* + * Source of account creation + */ + @JsonProperty(value = "accountCreationSource") + private AccountCreationSource accountCreationSource; + + /** Creates an instance of PlanDataProperties class. */ + public PlanDataProperties() { + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the PlanDataProperties object itself. + */ + public PlanDataProperties withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.orgCreationSource; + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the PlanDataProperties object itself. + */ + public PlanDataProperties withOrgCreationSource(OrgCreationSource orgCreationSource) { + this.orgCreationSource = orgCreationSource; + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.accountCreationSource; + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the PlanDataProperties object itself. + */ + public PlanDataProperties withAccountCreationSource(AccountCreationSource accountCreationSource) { + this.accountCreationSource = accountCreationSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (planData() != null) { + planData().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/PlanDataResourceInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/PlanDataResourceInner.java new file mode 100644 index 0000000000000..d541fd5140838 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/PlanDataResourceInner.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.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a PlanData resource. */ +@Fluent +public final class PlanDataResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties") + private PlanDataProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of PlanDataResourceInner class. */ + public PlanDataResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private PlanDataProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.innerProperties() == null ? null : this.innerProperties().planData(); + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the PlanDataResourceInner object itself. + */ + public PlanDataResourceInner withPlanData(PlanData planData) { + if (this.innerProperties() == null) { + this.innerProperties = new PlanDataProperties(); + } + this.innerProperties().withPlanData(planData); + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource(); + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the PlanDataResourceInner object itself. + */ + public PlanDataResourceInner withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new PlanDataProperties(); + } + this.innerProperties().withOrgCreationSource(orgCreationSource); + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource(); + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the PlanDataResourceInner object itself. + */ + public PlanDataResourceInner withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new PlanDataProperties(); + } + this.innerProperties().withAccountCreationSource(accountCreationSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleInner.java new file mode 100644 index 0000000000000..8a237df6055a4 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleInner.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A tag rule belonging to NewRelic account. */ +@Fluent +public final class TagRuleInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + @JsonProperty(value = "properties", required = true) + private MonitoringTagRulesPropertiesInner innerProperties = new MonitoringTagRulesPropertiesInner(); + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of TagRuleInner class. */ + public TagRuleInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private MonitoringTagRulesPropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.innerProperties() == null ? null : this.innerProperties().logRules(); + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the TagRuleInner object itself. + */ + public TagRuleInner withLogRules(LogRules logRules) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitoringTagRulesPropertiesInner(); + } + this.innerProperties().withLogRules(logRules); + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.innerProperties() == null ? null : this.innerProperties().metricRules(); + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the TagRuleInner object itself. + */ + public TagRuleInner withMetricRules(MetricRulesInner metricRules) { + if (this.innerProperties() == null) { + this.innerProperties = new MonitoringTagRulesPropertiesInner(); + } + this.innerProperties().withMetricRules(metricRules); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model TagRuleInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TagRuleInner.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleUpdateInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleUpdateInner.java new file mode 100644 index 0000000000000..dfef473f2a644 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleUpdateInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The type used for update operations of the TagRule. */ +@Fluent +public final class TagRuleUpdateInner { + /* + * The updatable properties of the TagRule. + */ + @JsonProperty(value = "properties") + private TagRuleUpdatePropertiesInner innerProperties; + + /** Creates an instance of TagRuleUpdateInner class. */ + public TagRuleUpdateInner() { + } + + /** + * Get the innerProperties property: The updatable properties of the TagRule. + * + * @return the innerProperties value. + */ + private TagRuleUpdatePropertiesInner innerProperties() { + return this.innerProperties; + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.innerProperties() == null ? null : this.innerProperties().logRules(); + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the TagRuleUpdateInner object itself. + */ + public TagRuleUpdateInner withLogRules(LogRules logRules) { + if (this.innerProperties() == null) { + this.innerProperties = new TagRuleUpdatePropertiesInner(); + } + this.innerProperties().withLogRules(logRules); + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.innerProperties() == null ? null : this.innerProperties().metricRules(); + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the TagRuleUpdateInner object itself. + */ + public TagRuleUpdateInner withMetricRules(MetricRulesInner metricRules) { + if (this.innerProperties() == null) { + this.innerProperties = new TagRuleUpdatePropertiesInner(); + } + this.innerProperties().withMetricRules(metricRules); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleUpdatePropertiesInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleUpdatePropertiesInner.java new file mode 100644 index 0000000000000..687bdad877088 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/TagRuleUpdatePropertiesInner.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The updatable properties of the TagRule. */ +@Fluent +public final class TagRuleUpdatePropertiesInner { + /* + * Set of rules for sending logs for the Monitor resource. + */ + @JsonProperty(value = "logRules") + private LogRules logRules; + + /* + * Set of rules for sending metrics for the Monitor resource. + */ + @JsonProperty(value = "metricRules") + private MetricRulesInner metricRules; + + /** Creates an instance of TagRuleUpdatePropertiesInner class. */ + public TagRuleUpdatePropertiesInner() { + } + + /** + * Get the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + public LogRules logRules() { + return this.logRules; + } + + /** + * Set the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @param logRules the logRules value to set. + * @return the TagRuleUpdatePropertiesInner object itself. + */ + public TagRuleUpdatePropertiesInner withLogRules(LogRules logRules) { + this.logRules = logRules; + return this; + } + + /** + * Get the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + public MetricRulesInner metricRules() { + return this.metricRules; + } + + /** + * Set the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @param metricRules the metricRules value to set. + * @return the TagRuleUpdatePropertiesInner object itself. + */ + public TagRuleUpdatePropertiesInner withMetricRules(MetricRulesInner metricRules) { + this.metricRules = metricRules; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logRules() != null) { + logRules().validate(); + } + if (metricRules() != null) { + metricRules().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/VMExtensionPayloadInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/VMExtensionPayloadInner.java new file mode 100644 index 0000000000000..c8bd75268003c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/VMExtensionPayloadInner.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Response of payload to be passed while installing VM agent. */ +@Fluent +public final class VMExtensionPayloadInner { + /* + * Ingestion key of the account + */ + @JsonProperty(value = "ingestionKey") + private String ingestionKey; + + /** Creates an instance of VMExtensionPayloadInner class. */ + public VMExtensionPayloadInner() { + } + + /** + * Get the ingestionKey property: Ingestion key of the account. + * + * @return the ingestionKey value. + */ + public String ingestionKey() { + return this.ingestionKey; + } + + /** + * Set the ingestionKey property: Ingestion key of the account. + * + * @param ingestionKey the ingestionKey value to set. + * @return the VMExtensionPayloadInner object itself. + */ + public VMExtensionPayloadInner withIngestionKey(String ingestionKey) { + this.ingestionKey = ingestionKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/VMInfoInner.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/VMInfoInner.java new file mode 100644 index 0000000000000..34029b0c1850d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/VMInfoInner.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Details of VM Resource having NewRelic OneAgent installed. */ +@Fluent +public final class VMInfoInner { + /* + * Azure VM resource ID + */ + @JsonProperty(value = "vmId") + private String vmId; + + /* + * Version of the NewRelic agent installed on the VM. + */ + @JsonProperty(value = "agentVersion") + private String agentVersion; + + /* + * Status of the NewRelic agent installed on the VM. + */ + @JsonProperty(value = "agentStatus") + private String agentStatus; + + /** Creates an instance of VMInfoInner class. */ + public VMInfoInner() { + } + + /** + * Get the vmId property: Azure VM resource ID. + * + * @return the vmId value. + */ + public String vmId() { + return this.vmId; + } + + /** + * Set the vmId property: Azure VM resource ID. + * + * @param vmId the vmId value to set. + * @return the VMInfoInner object itself. + */ + public VMInfoInner withVmId(String vmId) { + this.vmId = vmId; + return this; + } + + /** + * Get the agentVersion property: Version of the NewRelic agent installed on the VM. + * + * @return the agentVersion value. + */ + public String agentVersion() { + return this.agentVersion; + } + + /** + * Set the agentVersion property: Version of the NewRelic agent installed on the VM. + * + * @param agentVersion the agentVersion value to set. + * @return the VMInfoInner object itself. + */ + public VMInfoInner withAgentVersion(String agentVersion) { + this.agentVersion = agentVersion; + return this; + } + + /** + * Get the agentStatus property: Status of the NewRelic agent installed on the VM. + * + * @return the agentStatus value. + */ + public String agentStatus() { + return this.agentStatus; + } + + /** + * Set the agentStatus property: Status of the NewRelic agent installed on the VM. + * + * @param agentStatus the agentStatus value to set. + * @return the VMInfoInner object itself. + */ + public VMInfoInner withAgentStatus(String agentStatus) { + this.agentStatus = agentStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/package-info.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/package-info.java new file mode 100644 index 0000000000000..92ec93e13d33e --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// 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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelicobservability.fluent.models; diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/package-info.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/package-info.java new file mode 100644 index 0000000000000..9639651ea926e --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/fluent/package-info.java @@ -0,0 +1,6 @@ +// 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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelicobservability.fluent; diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountResourceImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountResourceImpl.java new file mode 100644 index 0000000000000..02212054a6241 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountResourceImpl.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.newrelicobservability.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountResource; + +public final class AccountResourceImpl implements AccountResource { + private AccountResourceInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + AccountResourceImpl( + AccountResourceInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String organizationId() { + return this.innerModel().organizationId(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public String accountName() { + return this.innerModel().accountName(); + } + + public String region() { + return this.innerModel().region(); + } + + public AccountResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountsClientImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountsClientImpl.java new file mode 100644 index 0000000000000..a04acdb1b9fb5 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountsClientImpl.java @@ -0,0 +1,332 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelicobservability.fluent.AccountsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountsListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AccountsClient. */ +public final class AccountsClientImpl implements AccountsClient { + /** The proxy service used to perform REST calls. */ + private final AccountsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of AccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AccountsClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(AccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityAccounts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface AccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("userEmail") String userEmail, + @QueryParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String userEmail, String location) { + 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 (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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(), + userEmail, + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String userEmail, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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(), + userEmail, + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location) { + return new PagedIterable<>(listAsync(userEmail, location)); + } + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location, Context context) { + return new PagedIterable<>(listAsync(userEmail, location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 response of get all accounts Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountsImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountsImpl.java new file mode 100644 index 0000000000000..c886051fb1ba0 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AccountsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.AccountsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountResource; +import com.azure.resourcemanager.newrelicobservability.models.Accounts; + +public final class AccountsImpl implements Accounts { + private static final ClientLogger LOGGER = new ClientLogger(AccountsImpl.class); + + private final AccountsClient innerClient; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public AccountsImpl( + AccountsClient innerClient, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String userEmail, String location) { + PagedIterable inner = this.serviceClient().list(userEmail, location); + return Utils.mapPage(inner, inner1 -> new AccountResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String userEmail, String location, Context context) { + PagedIterable inner = this.serviceClient().list(userEmail, location, context); + return Utils.mapPage(inner, inner1 -> new AccountResourceImpl(inner1, this.manager())); + } + + private AccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AppServiceInfoImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AppServiceInfoImpl.java new file mode 100644 index 0000000000000..d23cb2edb8530 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/AppServiceInfoImpl.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.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.AppServiceInfo; + +public final class AppServiceInfoImpl implements AppServiceInfo { + private AppServiceInfoInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + AppServiceInfoImpl( + AppServiceInfoInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String azureResourceId() { + return this.innerModel().azureResourceId(); + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public String agentStatus() { + return this.innerModel().agentStatus(); + } + + public AppServiceInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MetricRulesImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MetricRulesImpl.java new file mode 100644 index 0000000000000..5f217ce0d08c3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MetricRulesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import java.util.Collections; +import java.util.List; + +public final class MetricRulesImpl implements MetricRules { + private MetricRulesInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + MetricRulesImpl( + MetricRulesInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SendMetricsStatus sendMetrics() { + return this.innerModel().sendMetrics(); + } + + public List filteringTags() { + List inner = this.innerModel().filteringTags(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String userEmail() { + return this.innerModel().userEmail(); + } + + public MetricRulesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MetricsStatusResponseImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MetricsStatusResponseImpl.java new file mode 100644 index 0000000000000..a3550a8900319 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MetricsStatusResponseImpl.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusResponse; +import java.util.Collections; +import java.util.List; + +public final class MetricsStatusResponseImpl implements MetricsStatusResponse { + private MetricsStatusResponseInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + MetricsStatusResponseImpl( + MetricsStatusResponseInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List azureResourceIds() { + List inner = this.innerModel().azureResourceIds(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricsStatusResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitoredResourceImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitoredResourceImpl.java new file mode 100644 index 0000000000000..dbf820dee7c53 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitoredResourceImpl.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.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.MonitoredResource; +import com.azure.resourcemanager.newrelicobservability.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendingMetricsStatus; + +public final class MonitoredResourceImpl implements MonitoredResource { + private MonitoredResourceInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + MonitoredResourceImpl( + MonitoredResourceInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public SendingMetricsStatus sendingMetrics() { + return this.innerModel().sendingMetrics(); + } + + public String reasonForMetricsStatus() { + return this.innerModel().reasonForMetricsStatus(); + } + + public SendingLogsStatus sendingLogs() { + return this.innerModel().sendingLogs(); + } + + public String reasonForLogsStatus() { + return this.innerModel().reasonForLogsStatus(); + } + + public MonitoredResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitoringTagRulesPropertiesImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitoringTagRulesPropertiesImpl.java new file mode 100644 index 0000000000000..316db538be5a3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitoringTagRulesPropertiesImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoringTagRulesPropertiesInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.MonitoringTagRulesProperties; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; + +public final class MonitoringTagRulesPropertiesImpl implements MonitoringTagRulesProperties { + private MonitoringTagRulesPropertiesInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + MonitoringTagRulesPropertiesImpl( + MonitoringTagRulesPropertiesInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public MonitoringTagRulesPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitorsClientImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitorsClientImpl.java new file mode 100644 index 0000000000000..fabf74bf73f8a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitorsClientImpl.java @@ -0,0 +1,3052 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelicobservability.fluent.MonitorsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesListResponse; +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelicobservability.models.MonitoredResourceListResponse; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceListResult; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.VMHostsListResponse; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MonitorsClient. */ +public final class MonitorsClientImpl implements MonitorsClient { + /** The proxy service used to perform REST calls. */ + private final MonitorsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of MonitorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorsClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(MonitorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityMonitors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface MonitorsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/monitors") + @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/NewRelic.Observability/monitors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") NewRelicMonitorResourceInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") NewRelicMonitorResourceUpdate properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("userEmail") String userEmail, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/getMetricRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMetricRules( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") MetricsRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/getMetricStatus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getMetricStatus( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") MetricsStatusRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/listAppServices") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAppServices( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") AppServicesGetRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/switchBilling") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> switchBilling( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") SwitchBillingRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/listHosts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHosts( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @BodyParam("application/json") HostsGetRequest request, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/monitoredResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResources( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/vmHostPayloads") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> vmHostPayload( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAppServicesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listHostsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listMonitoredResourcesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String monitorName) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String monitorName, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String monitorName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner getByResourceGroup(String resourceGroupName, String monitorName) { + return getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + resource, + accept, + context); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NewRelicMonitorResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, resource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NewRelicMonitorResourceInner.class, + NewRelicMonitorResourceInner.class, + this.client.getContext()); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NewRelicMonitorResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, resource, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + NewRelicMonitorResourceInner.class, + NewRelicMonitorResourceInner.class, + context); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource).getSyncPoller(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NewRelicMonitorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource, context).getSyncPoller(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, monitorName, resource).block(); + } + + /** + * Create a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner createOrUpdate( + String resourceGroupName, String monitorName, NewRelicMonitorResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, monitorName, resource, context).block(); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName 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 + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName 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 + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + properties, + accept, + context); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties) { + return updateWithResponseAsync(resourceGroupName, monitorName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties, Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, properties, context).block(); + } + + /** + * Update a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Monitor Resource by NewRelic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NewRelicMonitorResourceInner update( + String resourceGroupName, String monitorName, NewRelicMonitorResourceUpdate properties) { + return updateWithResponse(resourceGroupName, monitorName, properties, Context.NONE).getValue(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String userEmail, String monitorName) { + 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 (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + userEmail, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String userEmail, String monitorName, 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 (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + userEmail, + monitorName, + accept, + context); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String userEmail, String monitorName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, userEmail, monitorName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String userEmail, String monitorName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, userEmail, monitorName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String userEmail, String monitorName) { + return this.beginDeleteAsync(resourceGroupName, userEmail, monitorName).getSyncPoller(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String userEmail, String monitorName, Context context) { + return this.beginDeleteAsync(resourceGroupName, userEmail, monitorName, context).getSyncPoller(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String userEmail, String monitorName) { + return beginDeleteAsync(resourceGroupName, userEmail, monitorName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String userEmail, String monitorName, Context context) { + return beginDeleteAsync(resourceGroupName, userEmail, monitorName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors 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 userEmail, String monitorName) { + deleteAsync(resourceGroupName, userEmail, monitorName).block(); + } + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String userEmail, String monitorName, Context context) { + deleteAsync(resourceGroupName, userEmail, monitorName, context).block(); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricRulesWithResponseAsync( + String resourceGroupName, String monitorName, MetricsRequest request) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMetricRules( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricRulesWithResponseAsync( + String resourceGroupName, String monitorName, MetricsRequest request, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMetricRules( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMetricRulesAsync( + String resourceGroupName, String monitorName, MetricsRequest request) { + return getMetricRulesWithResponseAsync(resourceGroupName, monitorName, request) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context) { + return getMetricRulesWithResponseAsync(resourceGroupName, monitorName, request, context).block(); + } + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricRulesInner getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request) { + return getMetricRulesWithResponse(resourceGroupName, monitorName, request, Context.NONE).getValue(); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricStatusWithResponseAsync( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getMetricStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getMetricStatusWithResponseAsync( + String resourceGroupName, String monitorName, MetricsStatusRequest request, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getMetricStatus( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getMetricStatusAsync( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + return getMetricStatusWithResponseAsync(resourceGroupName, monitorName, request) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context) { + return getMetricStatusWithResponseAsync(resourceGroupName, monitorName, request, context).block(); + } + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricsStatusResponseInner getMetricStatus( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + return getMetricStatusWithResponse(resourceGroupName, monitorName, request, Context.NONE).getValue(); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesSinglePageAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listAppServices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesSinglePageAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAppServices( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAppServicesAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + return new PagedFlux<>( + () -> listAppServicesSinglePageAsync(resourceGroupName, monitorName, request), + nextLink -> listAppServicesNextSinglePageAsync(nextLink)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAppServicesAsync( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + return new PagedFlux<>( + () -> listAppServicesSinglePageAsync(resourceGroupName, monitorName, request, context), + nextLink -> listAppServicesNextSinglePageAsync(nextLink, context)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + return new PagedIterable<>(listAppServicesAsync(resourceGroupName, monitorName, request)); + } + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + return new PagedIterable<>(listAppServicesAsync(resourceGroupName, monitorName, request, context)); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> switchBillingWithResponseAsync( + String resourceGroupName, String monitorName, SwitchBillingRequest request) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .switchBilling( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> switchBillingWithResponseAsync( + String resourceGroupName, String monitorName, SwitchBillingRequest request, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .switchBilling( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono switchBillingAsync(String resourceGroupName, String monitorName, SwitchBillingRequest request) { + return switchBillingWithResponseAsync(resourceGroupName, monitorName, request).flatMap(ignored -> Mono.empty()); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) { + return switchBillingWithResponseAsync(resourceGroupName, monitorName, request, context).block(); + } + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request) { + switchBillingWithResponse(resourceGroupName, monitorName, request, Context.NONE); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsSinglePageAsync( + String resourceGroupName, String monitorName, HostsGetRequest request) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listHosts( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsSinglePageAsync( + String resourceGroupName, String monitorName, HostsGetRequest request, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (request == null) { + return Mono.error(new IllegalArgumentException("Parameter request is required and cannot be null.")); + } else { + request.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHosts( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + request, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHostsAsync( + String resourceGroupName, String monitorName, HostsGetRequest request) { + return new PagedFlux<>( + () -> listHostsSinglePageAsync(resourceGroupName, monitorName, request), + nextLink -> listHostsNextSinglePageAsync(nextLink)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listHostsAsync( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + return new PagedFlux<>( + () -> listHostsSinglePageAsync(resourceGroupName, monitorName, request, context), + nextLink -> listHostsNextSinglePageAsync(nextLink, context)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request) { + return new PagedIterable<>(listHostsAsync(resourceGroupName, monitorName, request)); + } + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + return new PagedIterable<>(listHostsAsync(resourceGroupName, monitorName, request, context)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesSinglePageAsync( + String resourceGroupName, String monitorName, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResources( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listMonitoredResourcesAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listMonitoredResourcesSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listMonitoredResourcesNextSinglePageAsync(nextLink, context)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName)); + } + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listMonitoredResourcesAsync(resourceGroupName, monitorName, context)); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> vmHostPayloadWithResponseAsync( + String resourceGroupName, String monitorName) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .vmHostPayload( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> vmHostPayloadWithResponseAsync( + String resourceGroupName, String monitorName, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .vmHostPayload( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono vmHostPayloadAsync(String resourceGroupName, String monitorName) { + return vmHostPayloadWithResponseAsync(resourceGroupName, monitorName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context) { + return vmHostPayloadWithResponseAsync(resourceGroupName, monitorName, context).block(); + } + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VMExtensionPayloadInner vmHostPayload(String resourceGroupName, String monitorName) { + return vmHostPayloadWithResponse(resourceGroupName, monitorName, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAppServicesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 response of a list app services Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAppServicesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listAppServicesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listHostsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 response of a list VM Host Operation along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listHostsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listHostsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 all the resources being monitored by NewRelic monitor resource along with {@link PagedResponse} + * on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listMonitoredResourcesNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listMonitoredResourcesNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitorsImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitorsImpl.java new file mode 100644 index 0000000000000..22d7b51480503 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/MonitorsImpl.java @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.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.newrelicobservability.fluent.MonitorsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.AppServiceInfo; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusResponse; +import com.azure.resourcemanager.newrelicobservability.models.MonitoredResource; +import com.azure.resourcemanager.newrelicobservability.models.Monitors; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.VMExtensionPayload; +import com.azure.resourcemanager.newrelicobservability.models.VMInfo; + +public final class MonitorsImpl implements Monitors { + private static final ClientLogger LOGGER = new ClientLogger(MonitorsImpl.class); + + private final MonitorsClient innerClient; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public MonitorsImpl( + MonitorsClient innerClient, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new NewRelicMonitorResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NewRelicMonitorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public NewRelicMonitorResource getByResourceGroup(String resourceGroupName, String monitorName) { + NewRelicMonitorResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, monitorName); + if (inner != null) { + return new NewRelicMonitorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String userEmail, String monitorName) { + this.serviceClient().delete(resourceGroupName, userEmail, monitorName); + } + + public void delete(String resourceGroupName, String userEmail, String monitorName, Context context) { + this.serviceClient().delete(resourceGroupName, userEmail, monitorName, context); + } + + public Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context) { + Response inner = + this.serviceClient().getMetricRulesWithResponse(resourceGroupName, monitorName, request, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricRulesImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricRules getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request) { + MetricRulesInner inner = this.serviceClient().getMetricRules(resourceGroupName, monitorName, request); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context) { + Response inner = + this.serviceClient().getMetricStatusWithResponse(resourceGroupName, monitorName, request, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricsStatusResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricsStatusResponse getMetricStatus( + String resourceGroupName, String monitorName, MetricsStatusRequest request) { + MetricsStatusResponseInner inner = + this.serviceClient().getMetricStatus(resourceGroupName, monitorName, request); + if (inner != null) { + return new MetricsStatusResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request) { + PagedIterable inner = + this.serviceClient().listAppServices(resourceGroupName, monitorName, request); + return Utils.mapPage(inner, inner1 -> new AppServiceInfoImpl(inner1, this.manager())); + } + + public PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context) { + PagedIterable inner = + this.serviceClient().listAppServices(resourceGroupName, monitorName, request, context); + return Utils.mapPage(inner, inner1 -> new AppServiceInfoImpl(inner1, this.manager())); + } + + public Response switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context) { + return this.serviceClient().switchBillingWithResponse(resourceGroupName, monitorName, request, context); + } + + public void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request) { + this.serviceClient().switchBilling(resourceGroupName, monitorName, request); + } + + public PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request) { + PagedIterable inner = this.serviceClient().listHosts(resourceGroupName, monitorName, request); + return Utils.mapPage(inner, inner1 -> new VMInfoImpl(inner1, this.manager())); + } + + public PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context) { + PagedIterable inner = + this.serviceClient().listHosts(resourceGroupName, monitorName, request, context); + return Utils.mapPage(inner, inner1 -> new VMInfoImpl(inner1, this.manager())); + } + + public PagedIterable listMonitoredResources(String resourceGroupName, String monitorName) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().listMonitoredResources(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new MonitoredResourceImpl(inner1, this.manager())); + } + + public Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context) { + Response inner = + this.serviceClient().vmHostPayloadWithResponse(resourceGroupName, monitorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VMExtensionPayloadImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VMExtensionPayload vmHostPayload(String resourceGroupName, String monitorName) { + VMExtensionPayloadInner inner = this.serviceClient().vmHostPayload(resourceGroupName, monitorName); + if (inner != null) { + return new VMExtensionPayloadImpl(inner, this.manager()); + } else { + return null; + } + } + + public NewRelicMonitorResource 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 monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, monitorName, 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 monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, monitorName, context); + } + + private MonitorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } + + public NewRelicMonitorResourceImpl define(String name) { + return new NewRelicMonitorResourceImpl(name, this.manager()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicMonitorResourceImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicMonitorResourceImpl.java new file mode 100644 index 0000000000000..bbeb053af85b2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicMonitorResourceImpl.java @@ -0,0 +1,372 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.AppServiceInfo; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.LiftrResourceCategories; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.MarketplaceSubscriptionStatus; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusResponse; +import com.azure.resourcemanager.newrelicobservability.models.MonitoredResource; +import com.azure.resourcemanager.newrelicobservability.models.MonitoringStatus; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import com.azure.resourcemanager.newrelicobservability.models.VMExtensionPayload; +import com.azure.resourcemanager.newrelicobservability.models.VMInfo; +import java.util.Collections; +import java.util.Map; + +public final class NewRelicMonitorResourceImpl + implements NewRelicMonitorResource, NewRelicMonitorResource.Definition, NewRelicMonitorResource.Update { + private NewRelicMonitorResourceInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public MonitoringStatus monitoringStatus() { + return this.innerModel().monitoringStatus(); + } + + public MarketplaceSubscriptionStatus marketplaceSubscriptionStatus() { + return this.innerModel().marketplaceSubscriptionStatus(); + } + + public String marketplaceSubscriptionId() { + return this.innerModel().marketplaceSubscriptionId(); + } + + public NewRelicAccountProperties newRelicAccountProperties() { + return this.innerModel().newRelicAccountProperties(); + } + + public UserInfo userInfo() { + return this.innerModel().userInfo(); + } + + public PlanData planData() { + return this.innerModel().planData(); + } + + public LiftrResourceCategories liftrResourceCategory() { + return this.innerModel().liftrResourceCategory(); + } + + public Integer liftrResourcePreference() { + return this.innerModel().liftrResourcePreference(); + } + + public OrgCreationSource orgCreationSource() { + return this.innerModel().orgCreationSource(); + } + + public AccountCreationSource accountCreationSource() { + return this.innerModel().accountCreationSource(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NewRelicMonitorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private NewRelicMonitorResourceUpdate updateProperties; + + public NewRelicMonitorResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public NewRelicMonitorResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .createOrUpdate(resourceGroupName, monitorName, this.innerModel(), Context.NONE); + return this; + } + + public NewRelicMonitorResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .createOrUpdate(resourceGroupName, monitorName, this.innerModel(), context); + return this; + } + + NewRelicMonitorResourceImpl( + String name, com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = new NewRelicMonitorResourceInner(); + this.serviceManager = serviceManager; + this.monitorName = name; + } + + public NewRelicMonitorResourceImpl update() { + this.updateProperties = new NewRelicMonitorResourceUpdate(); + return this; + } + + public NewRelicMonitorResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public NewRelicMonitorResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .updateWithResponse(resourceGroupName, monitorName, updateProperties, context) + .getValue(); + return this; + } + + NewRelicMonitorResourceImpl( + NewRelicMonitorResourceInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + } + + public NewRelicMonitorResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, Context.NONE) + .getValue(); + return this; + } + + public NewRelicMonitorResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMonitors() + .getByResourceGroupWithResponse(resourceGroupName, monitorName, context) + .getValue(); + return this; + } + + public Response getMetricRulesWithResponse(MetricsRequest request, Context context) { + return serviceManager.monitors().getMetricRulesWithResponse(resourceGroupName, monitorName, request, context); + } + + public MetricRules getMetricRules(MetricsRequest request) { + return serviceManager.monitors().getMetricRules(resourceGroupName, monitorName, request); + } + + public Response getMetricStatusWithResponse(MetricsStatusRequest request, Context context) { + return serviceManager.monitors().getMetricStatusWithResponse(resourceGroupName, monitorName, request, context); + } + + public MetricsStatusResponse getMetricStatus(MetricsStatusRequest request) { + return serviceManager.monitors().getMetricStatus(resourceGroupName, monitorName, request); + } + + public PagedIterable listAppServices(AppServicesGetRequest request) { + return serviceManager.monitors().listAppServices(resourceGroupName, monitorName, request); + } + + public PagedIterable listAppServices(AppServicesGetRequest request, Context context) { + return serviceManager.monitors().listAppServices(resourceGroupName, monitorName, request, context); + } + + public Response switchBillingWithResponse(SwitchBillingRequest request, Context context) { + return serviceManager.monitors().switchBillingWithResponse(resourceGroupName, monitorName, request, context); + } + + public void switchBilling(SwitchBillingRequest request) { + serviceManager.monitors().switchBilling(resourceGroupName, monitorName, request); + } + + public PagedIterable listHosts(HostsGetRequest request) { + return serviceManager.monitors().listHosts(resourceGroupName, monitorName, request); + } + + public PagedIterable listHosts(HostsGetRequest request, Context context) { + return serviceManager.monitors().listHosts(resourceGroupName, monitorName, request, context); + } + + public PagedIterable listMonitoredResources() { + return serviceManager.monitors().listMonitoredResources(resourceGroupName, monitorName); + } + + public PagedIterable listMonitoredResources(Context context) { + return serviceManager.monitors().listMonitoredResources(resourceGroupName, monitorName, context); + } + + public Response vmHostPayloadWithResponse(Context context) { + return serviceManager.monitors().vmHostPayloadWithResponse(resourceGroupName, monitorName, context); + } + + public VMExtensionPayload vmHostPayload() { + return serviceManager.monitors().vmHostPayload(resourceGroupName, monitorName); + } + + public NewRelicMonitorResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NewRelicMonitorResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NewRelicMonitorResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public NewRelicMonitorResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public NewRelicMonitorResourceImpl withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + if (isInCreateMode()) { + this.innerModel().withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } else { + this.updateProperties.withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } + } + + public NewRelicMonitorResourceImpl withUserInfo(UserInfo userInfo) { + if (isInCreateMode()) { + this.innerModel().withUserInfo(userInfo); + return this; + } else { + this.updateProperties.withUserInfo(userInfo); + return this; + } + } + + public NewRelicMonitorResourceImpl withPlanData(PlanData planData) { + if (isInCreateMode()) { + this.innerModel().withPlanData(planData); + return this; + } else { + this.updateProperties.withPlanData(planData); + return this; + } + } + + public NewRelicMonitorResourceImpl withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (isInCreateMode()) { + this.innerModel().withOrgCreationSource(orgCreationSource); + return this; + } else { + this.updateProperties.withOrgCreationSource(orgCreationSource); + return this; + } + } + + public NewRelicMonitorResourceImpl withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (isInCreateMode()) { + this.innerModel().withAccountCreationSource(accountCreationSource); + return this; + } else { + this.updateProperties.withAccountCreationSource(accountCreationSource); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicObservabilityBuilder.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicObservabilityBuilder.java new file mode 100644 index 0000000000000..67751d8138dc1 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicObservabilityBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the NewRelicObservabilityImpl type. */ +@ServiceClientBuilder(serviceClients = {NewRelicObservabilityImpl.class}) +public final class NewRelicObservabilityBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder 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 NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the NewRelicObservabilityBuilder. + */ + public NewRelicObservabilityBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of NewRelicObservabilityImpl with the provided parameters. + * + * @return an instance of NewRelicObservabilityImpl. + */ + public NewRelicObservabilityImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + NewRelicObservabilityImpl client = + new NewRelicObservabilityImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicObservabilityImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicObservabilityImpl.java new file mode 100644 index 0000000000000..aac210c97b7cd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/NewRelicObservabilityImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.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.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.newrelicobservability.fluent.AccountsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.MonitorsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.NewRelicObservability; +import com.azure.resourcemanager.newrelicobservability.fluent.OperationsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.OrganizationsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.PlansClient; +import com.azure.resourcemanager.newrelicobservability.fluent.TagRulesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the NewRelicObservabilityImpl type. */ +@ServiceClient(builder = NewRelicObservabilityBuilder.class) +public final class NewRelicObservabilityImpl implements NewRelicObservability { + /** 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 AccountsClient object to access its operations. */ + private final AccountsClient accounts; + + /** + * Gets the AccountsClient object to access its operations. + * + * @return the AccountsClient object. + */ + public AccountsClient getAccounts() { + return this.accounts; + } + + /** The MonitorsClient object to access its operations. */ + private final MonitorsClient monitors; + + /** + * Gets the MonitorsClient object to access its operations. + * + * @return the MonitorsClient object. + */ + public MonitorsClient getMonitors() { + return this.monitors; + } + + /** The OrganizationsClient object to access its operations. */ + private final OrganizationsClient organizations; + + /** + * Gets the OrganizationsClient object to access its operations. + * + * @return the OrganizationsClient object. + */ + public OrganizationsClient getOrganizations() { + return this.organizations; + } + + /** The PlansClient object to access its operations. */ + private final PlansClient plans; + + /** + * Gets the PlansClient object to access its operations. + * + * @return the PlansClient object. + */ + public PlansClient getPlans() { + return this.plans; + } + + /** The TagRulesClient object to access its operations. */ + private final TagRulesClient tagRules; + + /** + * Gets the TagRulesClient object to access its operations. + * + * @return the TagRulesClient object. + */ + public TagRulesClient getTagRules() { + return this.tagRules; + } + + /** + * Initializes an instance of NewRelicObservability 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. + */ + NewRelicObservabilityImpl( + 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 = "2022-07-01-preview"; + this.operations = new OperationsClientImpl(this); + this.accounts = new AccountsClientImpl(this); + this.monitors = new MonitorsClientImpl(this); + this.organizations = new OrganizationsClientImpl(this); + this.plans = new PlansClientImpl(this); + this.tagRules = new TagRulesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NewRelicObservabilityImpl.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationImpl.java new file mode 100644 index 0000000000000..6339a7b4a6b17 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelicobservability.models.ActionType; +import com.azure.resourcemanager.newrelicobservability.models.Operation; +import com.azure.resourcemanager.newrelicobservability.models.OperationDisplay; +import com.azure.resourcemanager.newrelicobservability.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationsClientImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..aee3a4abf759b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationsClientImpl.java @@ -0,0 +1,276 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelicobservability.fluent.OperationsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelicobservability.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(NewRelicObservabilityImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/NewRelic.Observability/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationsImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..222e5521841f9 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.OperationsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelicobservability.models.Operation; +import com.azure.resourcemanager.newrelicobservability.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationResourceImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationResourceImpl.java new file mode 100644 index 0000000000000..13feaea00a58b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationResourceImpl.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.newrelicobservability.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationResource; + +public final class OrganizationResourceImpl implements OrganizationResource { + private OrganizationResourceInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + OrganizationResourceImpl( + OrganizationResourceInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String organizationId() { + return this.innerModel().organizationId(); + } + + public String organizationName() { + return this.innerModel().organizationName(); + } + + public BillingSource billingSource() { + return this.innerModel().billingSource(); + } + + public OrganizationResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationsClientImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationsClientImpl.java new file mode 100644 index 0000000000000..ce6b533efc2de --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationsClientImpl.java @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelicobservability.fluent.OrganizationsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationsListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OrganizationsClient. */ +public final class OrganizationsClientImpl implements OrganizationsClient { + /** The proxy service used to perform REST calls. */ + private final OrganizationsService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of OrganizationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OrganizationsClientImpl(NewRelicObservabilityImpl client) { + this.service = + RestProxy.create(OrganizationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityOrganizations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface OrganizationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/organizations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("userEmail") String userEmail, + @QueryParam("location") String location, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String userEmail, String location) { + 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 (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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(), + userEmail, + location, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String userEmail, 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 (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (userEmail == null) { + return Mono.error(new IllegalArgumentException("Parameter userEmail is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location 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(), + userEmail, + location, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String userEmail, String location, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(userEmail, location, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location) { + return new PagedIterable<>(listAsync(userEmail, location)); + } + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String userEmail, String location, Context context) { + return new PagedIterable<>(listAsync(userEmail, location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 response of get all organizations Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationsImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationsImpl.java new file mode 100644 index 0000000000000..29964833116f3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/OrganizationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.OrganizationsClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationResource; +import com.azure.resourcemanager.newrelicobservability.models.Organizations; + +public final class OrganizationsImpl implements Organizations { + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsImpl.class); + + private final OrganizationsClient innerClient; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public OrganizationsImpl( + OrganizationsClient innerClient, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String userEmail, String location) { + PagedIterable inner = this.serviceClient().list(userEmail, location); + return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String userEmail, String location, Context context) { + PagedIterable inner = this.serviceClient().list(userEmail, location, context); + return Utils.mapPage(inner, inner1 -> new OrganizationResourceImpl(inner1, this.manager())); + } + + private OrganizationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlanDataResourceImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlanDataResourceImpl.java new file mode 100644 index 0000000000000..8417a3ff9c564 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlanDataResourceImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.PlanDataResource; + +public final class PlanDataResourceImpl implements PlanDataResource { + private PlanDataResourceInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + PlanDataResourceImpl( + PlanDataResourceInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public PlanData planData() { + return this.innerModel().planData(); + } + + public OrgCreationSource orgCreationSource() { + return this.innerModel().orgCreationSource(); + } + + public AccountCreationSource accountCreationSource() { + return this.innerModel().accountCreationSource(); + } + + public PlanDataResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlansClientImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlansClientImpl.java new file mode 100644 index 0000000000000..eb4549b896813 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlansClientImpl.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.newrelicobservability.fluent.PlansClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.PlanDataListResponse; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PlansClient. */ +public final class PlansClientImpl implements PlansClient { + /** The proxy service used to perform REST calls. */ + private final PlansService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of PlansClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PlansClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(PlansService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityPlans to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface PlansService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/NewRelic.Observability/plans") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("accountId") String accountId, + @QueryParam("organizationId") String organizationId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String accountId, String organizationId) { + 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(), + accountId, + organizationId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String accountId, String organizationId, 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(), + accountId, + organizationId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String accountId, String organizationId) { + return new PagedFlux<>( + () -> listSinglePageAsync(accountId, organizationId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List plans data. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String accountId = null; + final String organizationId = null; + return new PagedFlux<>( + () -> listSinglePageAsync(accountId, organizationId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String accountId, String organizationId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(accountId, organizationId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List plans data. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String accountId = null; + final String organizationId = null; + return new PagedIterable<>(listAsync(accountId, organizationId)); + } + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String accountId, String organizationId, Context context) { + return new PagedIterable<>(listAsync(accountId, organizationId, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @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 response of get all plan data Operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlansImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlansImpl.java new file mode 100644 index 0000000000000..90f4e3a0f3ca5 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/PlansImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.PlansClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.PlanDataResource; +import com.azure.resourcemanager.newrelicobservability.models.Plans; + +public final class PlansImpl implements Plans { + private static final ClientLogger LOGGER = new ClientLogger(PlansImpl.class); + + private final PlansClient innerClient; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public PlansImpl( + PlansClient innerClient, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new PlanDataResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String accountId, String organizationId, Context context) { + PagedIterable inner = this.serviceClient().list(accountId, organizationId, context); + return Utils.mapPage(inner, inner1 -> new PlanDataResourceImpl(inner1, this.manager())); + } + + private PlansClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleImpl.java new file mode 100644 index 0000000000000..a83030e577bef --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleImpl.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; + +public final class TagRuleImpl implements TagRule, TagRule.Definition, TagRule.Update { + private TagRuleInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public TagRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String monitorName; + + private String ruleSetName; + + private TagRuleUpdateInner updateProperties; + + public TagRuleImpl withExistingMonitor(String resourceGroupName, String monitorName) { + this.resourceGroupName = resourceGroupName; + this.monitorName = monitorName; + return this; + } + + public TagRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdate(resourceGroupName, monitorName, ruleSetName, this.innerModel(), Context.NONE); + return this; + } + + public TagRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .createOrUpdate(resourceGroupName, monitorName, ruleSetName, this.innerModel(), context); + return this; + } + + TagRuleImpl( + String name, com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = new TagRuleInner(); + this.serviceManager = serviceManager; + this.ruleSetName = name; + } + + public TagRuleImpl update() { + this.updateProperties = new TagRuleUpdateInner(); + return this; + } + + public TagRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .updateWithResponse(resourceGroupName, monitorName, ruleSetName, updateProperties, Context.NONE) + .getValue(); + return this; + } + + public TagRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .updateWithResponse(resourceGroupName, monitorName, ruleSetName, updateProperties, context) + .getValue(); + return this; + } + + TagRuleImpl( + TagRuleInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.monitorName = Utils.getValueFromIdByName(innerObject.id(), "monitors"); + this.ruleSetName = Utils.getValueFromIdByName(innerObject.id(), "tagRules"); + } + + public TagRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE) + .getValue(); + return this; + } + + public TagRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTagRules() + .getWithResponse(resourceGroupName, monitorName, ruleSetName, context) + .getValue(); + return this; + } + + public TagRuleImpl withLogRules(LogRules logRules) { + if (isInCreateMode()) { + this.innerModel().withLogRules(logRules); + return this; + } else { + this.updateProperties.withLogRules(logRules); + return this; + } + } + + public TagRuleImpl withMetricRules(MetricRulesInner metricRules) { + if (isInCreateMode()) { + this.innerModel().withMetricRules(metricRules); + return this; + } else { + this.updateProperties.withMetricRules(metricRules); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleUpdateImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleUpdateImpl.java new file mode 100644 index 0000000000000..0cf157890469b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleUpdateImpl.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.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.TagRuleUpdate; + +public final class TagRuleUpdateImpl implements TagRuleUpdate { + private TagRuleUpdateInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + TagRuleUpdateImpl( + TagRuleUpdateInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public TagRuleUpdateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleUpdatePropertiesImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleUpdatePropertiesImpl.java new file mode 100644 index 0000000000000..28601f6977eac --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRuleUpdatePropertiesImpl.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.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdatePropertiesInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.TagRuleUpdateProperties; + +public final class TagRuleUpdatePropertiesImpl implements TagRuleUpdateProperties { + private TagRuleUpdatePropertiesInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + TagRuleUpdatePropertiesImpl( + TagRuleUpdatePropertiesInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public LogRules logRules() { + return this.innerModel().logRules(); + } + + public MetricRules metricRules() { + MetricRulesInner inner = this.innerModel().metricRules(); + if (inner != null) { + return new MetricRulesImpl(inner, this.manager()); + } else { + return null; + } + } + + public TagRuleUpdatePropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRulesClientImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRulesClientImpl.java new file mode 100644 index 0000000000000..d08c7fda411ad --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRulesClientImpl.java @@ -0,0 +1,1289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.newrelicobservability.fluent.TagRulesClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelicobservability.models.TagRuleListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TagRulesClient. */ +public final class TagRulesClientImpl implements TagRulesClient { + /** The proxy service used to perform REST calls. */ + private final TagRulesService service; + + /** The service client containing this operation class. */ + private final NewRelicObservabilityImpl client; + + /** + * Initializes an instance of TagRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TagRulesClientImpl(NewRelicObservabilityImpl client) { + this.service = RestProxy.create(TagRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for NewRelicObservabilityTagRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "NewRelicObservabilit") + public interface TagRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByNewRelicMonitorResource( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @BodyParam("application/json") TagRuleInner resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/NewRelic.Observability/monitors/{monitorName}/tagRules/{ruleSetName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("monitorName") String monitorName, + @PathParam("ruleSetName") String ruleSetName, + @BodyParam("application/json") TagRuleUpdateInner properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByNewRelicMonitorResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceSinglePageAsync( + String resourceGroupName, String monitorName) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByNewRelicMonitorResource( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceSinglePageAsync( + String resourceGroupName, String monitorName, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByNewRelicMonitorResource( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByNewRelicMonitorResourceAsync(String resourceGroupName, String monitorName) { + return new PagedFlux<>( + () -> listByNewRelicMonitorResourceSinglePageAsync(resourceGroupName, monitorName), + nextLink -> listByNewRelicMonitorResourceNextSinglePageAsync(nextLink)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 of a TagRule list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByNewRelicMonitorResourceAsync( + String resourceGroupName, String monitorName, Context context) { + return new PagedFlux<>( + () -> listByNewRelicMonitorResourceSinglePageAsync(resourceGroupName, monitorName, context), + nextLink -> listByNewRelicMonitorResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName) { + return new PagedIterable<>(listByNewRelicMonitorResourceAsync(resourceGroupName, monitorName)); + } + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByNewRelicMonitorResource( + String resourceGroupName, String monitorName, Context context) { + return new PagedIterable<>(listByNewRelicMonitorResourceAsync(resourceGroupName, monitorName, context)); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return getWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + } + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner get(String resourceGroupName, String monitorName, String ruleSetName) { + return getWithResponse(resourceGroupName, monitorName, ruleSetName, Context.NONE).getValue(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + resource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + resource, + accept, + context); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TagRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, resource); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TagRuleInner.class, TagRuleInner.class, this.client.getContext()); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TagRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, resource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), TagRuleInner.class, TagRuleInner.class, context); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource).getSyncPoller(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TagRuleInner> beginCreateOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource, context) + .getSyncPoller(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource) { + return createOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource).block(); + } + + /** + * Create a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner createOrUpdate( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, monitorName, ruleSetName, resource, context).block(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, 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 (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + accept, + context); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, String ruleSetName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, monitorName, ruleSetName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String ruleSetName) { + return this.beginDeleteAsync(resourceGroupName, monitorName, ruleSetName).getSyncPoller(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return this.beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context).getSyncPoller(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String ruleSetName) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + return beginDeleteAsync(resourceGroupName, monitorName, ruleSetName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 monitorName, String ruleSetName) { + deleteAsync(resourceGroupName, monitorName, ruleSetName).block(); + } + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + deleteAsync(resourceGroupName, monitorName, ruleSetName, context).block(); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName 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 + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String monitorName, + String ruleSetName, + TagRuleUpdateInner properties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (monitorName == null) { + return Mono.error(new IllegalArgumentException("Parameter monitorName is required and cannot be null.")); + } + if (ruleSetName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleSetName 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 + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + monitorName, + ruleSetName, + properties, + accept, + context); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties) { + return updateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String monitorName, + String ruleSetName, + TagRuleUpdateInner properties, + Context context) { + return updateWithResponseAsync(resourceGroupName, monitorName, ruleSetName, properties, context).block(); + } + + /** + * Update a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a tag rule belonging to NewRelic account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TagRuleInner update( + String resourceGroupName, String monitorName, String ruleSetName, TagRuleUpdateInner properties) { + return updateWithResponse(resourceGroupName, monitorName, ruleSetName, properties, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByNewRelicMonitorResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNewRelicMonitorResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByNewRelicMonitorResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRulesImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRulesImpl.java new file mode 100644 index 0000000000000..72b45190028d9 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/TagRulesImpl.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.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.newrelicobservability.fluent.TagRulesClient; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; +import com.azure.resourcemanager.newrelicobservability.models.TagRules; + +public final class TagRulesImpl implements TagRules { + private static final ClientLogger LOGGER = new ClientLogger(TagRulesImpl.class); + + private final TagRulesClient innerClient; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + public TagRulesImpl( + TagRulesClient innerClient, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName) { + PagedIterable inner = + this.serviceClient().listByNewRelicMonitorResource(resourceGroupName, monitorName); + return Utils.mapPage(inner, inner1 -> new TagRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByNewRelicMonitorResource( + String resourceGroupName, String monitorName, Context context) { + PagedIterable inner = + this.serviceClient().listByNewRelicMonitorResource(resourceGroupName, monitorName, context); + return Utils.mapPage(inner, inner1 -> new TagRuleImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, monitorName, ruleSetName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TagRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TagRule get(String resourceGroupName, String monitorName, String ruleSetName) { + TagRuleInner inner = this.serviceClient().get(resourceGroupName, monitorName, ruleSetName); + if (inner != null) { + return new TagRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String monitorName, String ruleSetName) { + this.serviceClient().delete(resourceGroupName, monitorName, ruleSetName); + } + + public void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context) { + this.serviceClient().delete(resourceGroupName, monitorName, ruleSetName, context); + } + + public TagRule 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 monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, ruleSetName, 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 monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + return this.getWithResponse(resourceGroupName, monitorName, ruleSetName, 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 monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + this.delete(resourceGroupName, monitorName, ruleSetName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String monitorName = Utils.getValueFromIdByName(id, "monitors"); + if (monitorName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'monitors'.", id))); + } + String ruleSetName = Utils.getValueFromIdByName(id, "tagRules"); + if (ruleSetName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tagRules'.", id))); + } + this.delete(resourceGroupName, monitorName, ruleSetName, context); + } + + private TagRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } + + public TagRuleImpl define(String name) { + return new TagRuleImpl(name, this.manager()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/Utils.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/Utils.java new file mode 100644 index 0000000000000..ebc02c51a68de --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/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.newrelicobservability.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/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/VMExtensionPayloadImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/VMExtensionPayloadImpl.java new file mode 100644 index 0000000000000..b39677fa0d3bd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/VMExtensionPayloadImpl.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.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMExtensionPayloadInner; +import com.azure.resourcemanager.newrelicobservability.models.VMExtensionPayload; + +public final class VMExtensionPayloadImpl implements VMExtensionPayload { + private VMExtensionPayloadInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + VMExtensionPayloadImpl( + VMExtensionPayloadInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String ingestionKey() { + return this.innerModel().ingestionKey(); + } + + public VMExtensionPayloadInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/VMInfoImpl.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/VMInfoImpl.java new file mode 100644 index 0000000000000..894cef3b2b8c2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/VMInfoImpl.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.newrelicobservability.implementation; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.VMInfo; + +public final class VMInfoImpl implements VMInfo { + private VMInfoInner innerObject; + + private final com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager; + + VMInfoImpl( + VMInfoInner innerObject, + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String vmId() { + return this.innerModel().vmId(); + } + + public String agentVersion() { + return this.innerModel().agentVersion(); + } + + public String agentStatus() { + return this.innerModel().agentStatus(); + } + + public VMInfoInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/package-info.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/package-info.java new file mode 100644 index 0000000000000..2b3418cf1786a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/implementation/package-info.java @@ -0,0 +1,6 @@ +// 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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelicobservability.implementation; diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountCreationSource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountCreationSource.java new file mode 100644 index 0000000000000..95f7f6dbfca44 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountCreationSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Source of Account creation. */ +public final class AccountCreationSource extends ExpandableStringEnum { + /** Static value LIFTR for AccountCreationSource. */ + public static final AccountCreationSource LIFTR = fromString("LIFTR"); + + /** Static value NEWRELIC for AccountCreationSource. */ + public static final AccountCreationSource NEWRELIC = fromString("NEWRELIC"); + + /** + * Creates a new instance of AccountCreationSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccountCreationSource() { + } + + /** + * Creates or finds a AccountCreationSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccountCreationSource. + */ + @JsonCreator + public static AccountCreationSource fromString(String name) { + return fromString(name, AccountCreationSource.class); + } + + /** + * Gets known AccountCreationSource values. + * + * @return known AccountCreationSource values. + */ + public static Collection values() { + return values(AccountCreationSource.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountInfo.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountInfo.java new file mode 100644 index 0000000000000..a8b864c2ad146 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountInfo.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Account Info of the NewRelic account. */ +@Fluent +public final class AccountInfo { + /* + * Account id + */ + @JsonProperty(value = "accountId") + private String accountId; + + /* + * ingestion key of account + */ + @JsonProperty(value = "ingestionKey") + private String ingestionKey; + + /* + * NewRelic account region + */ + @JsonProperty(value = "region") + private String region; + + /** Creates an instance of AccountInfo class. */ + public AccountInfo() { + } + + /** + * Get the accountId property: Account id. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Set the accountId property: Account id. + * + * @param accountId the accountId value to set. + * @return the AccountInfo object itself. + */ + public AccountInfo withAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + /** + * Get the ingestionKey property: ingestion key of account. + * + * @return the ingestionKey value. + */ + public String ingestionKey() { + return this.ingestionKey; + } + + /** + * Set the ingestionKey property: ingestion key of account. + * + * @param ingestionKey the ingestionKey value to set. + * @return the AccountInfo object itself. + */ + public AccountInfo withIngestionKey(String ingestionKey) { + this.ingestionKey = ingestionKey; + return this; + } + + /** + * Get the region property: NewRelic account region. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: NewRelic account region. + * + * @param region the region value to set. + * @return the AccountInfo object itself. + */ + public AccountInfo withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountResource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountResource.java new file mode 100644 index 0000000000000..14d8cad0caa08 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountResource.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; + +/** An immutable client-side representation of AccountResource. */ +public interface AccountResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the organizationId property: organization id. + * + * @return the organizationId value. + */ + String organizationId(); + + /** + * Gets the accountId property: account id. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the accountName property: account name. + * + * @return the accountName value. + */ + String accountName(); + + /** + * Gets the region property: region. + * + * @return the region value. + */ + String region(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner object. + * + * @return the inner object. + */ + AccountResourceInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Accounts.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Accounts.java new file mode 100644 index 0000000000000..d12ca442f7dcd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Accounts.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.newrelicobservability.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Accounts. */ +public interface Accounts { + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location); + + /** + * List all the existing accounts. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all accounts Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountsListResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountsListResponse.java new file mode 100644 index 0000000000000..ee3097140c64f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AccountsListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get all accounts Operation. */ +@Fluent +public final class AccountsListResponse { + /* + * The AccountResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AccountsListResponse class. */ + public AccountsListResponse() { + } + + /** + * Get the value property: The AccountResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The AccountResource items on this page. + * + * @param value the value value to set. + * @return the AccountsListResponse object itself. + */ + public AccountsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the AccountsListResponse object itself. + */ + public AccountsListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AccountsListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccountsListResponse.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ActionType.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ActionType.java new file mode 100644 index 0000000000000..4886ca885a69d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServiceInfo.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServiceInfo.java new file mode 100644 index 0000000000000..0469ff65c3a32 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServiceInfo.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; + +/** An immutable client-side representation of AppServiceInfo. */ +public interface AppServiceInfo { + /** + * Gets the azureResourceId property: Azure App service resource ID. + * + * @return the azureResourceId value. + */ + String azureResourceId(); + + /** + * Gets the agentVersion property: Version of the NewRelic agent installed on the App service. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the agentStatus property: Status of the NewRelic agent installed on the App service. + * + * @return the agentStatus value. + */ + String agentStatus(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner object. + * + * @return the inner object. + */ + AppServiceInfoInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServicesGetRequest.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServicesGetRequest.java new file mode 100644 index 0000000000000..9b7135546362d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServicesGetRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of a app services get Operation. */ +@Fluent +public final class AppServicesGetRequest { + /* + * Azure resource IDs + */ + @JsonProperty(value = "azureResourceIds") + private List azureResourceIds; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of AppServicesGetRequest class. */ + public AppServicesGetRequest() { + } + + /** + * Get the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + public List azureResourceIds() { + return this.azureResourceIds; + } + + /** + * Set the azureResourceIds property: Azure resource IDs. + * + * @param azureResourceIds the azureResourceIds value to set. + * @return the AppServicesGetRequest object itself. + */ + public AppServicesGetRequest withAzureResourceIds(List azureResourceIds) { + this.azureResourceIds = azureResourceIds; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the AppServicesGetRequest object itself. + */ + public AppServicesGetRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model AppServicesGetRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AppServicesGetRequest.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServicesListResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServicesListResponse.java new file mode 100644 index 0000000000000..aeba394ecf674 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/AppServicesListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list app services Operation. */ +@Fluent +public final class AppServicesListResponse { + /* + * The AppServiceInfo items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AppServicesListResponse class. */ + public AppServicesListResponse() { + } + + /** + * Get the value property: The AppServiceInfo items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The AppServiceInfo items on this page. + * + * @param value the value value to set. + * @return the AppServicesListResponse object itself. + */ + public AppServicesListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the AppServicesListResponse object itself. + */ + public AppServicesListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model AppServicesListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AppServicesListResponse.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/BillingCycle.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/BillingCycle.java new file mode 100644 index 0000000000000..4f150e76b4ee7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/BillingCycle.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Different usage type like YEARLY/MONTHLY. */ +public final class BillingCycle extends ExpandableStringEnum { + /** Static value YEARLY for BillingCycle. */ + public static final BillingCycle YEARLY = fromString("YEARLY"); + + /** Static value MONTHLY for BillingCycle. */ + public static final BillingCycle MONTHLY = fromString("MONTHLY"); + + /** Static value WEEKLY for BillingCycle. */ + public static final BillingCycle WEEKLY = fromString("WEEKLY"); + + /** + * Creates a new instance of BillingCycle value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingCycle() { + } + + /** + * Creates or finds a BillingCycle from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingCycle. + */ + @JsonCreator + public static BillingCycle fromString(String name) { + return fromString(name, BillingCycle.class); + } + + /** + * Gets known BillingCycle values. + * + * @return known BillingCycle values. + */ + public static Collection values() { + return values(BillingCycle.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/BillingSource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/BillingSource.java new file mode 100644 index 0000000000000..fb8c2d44ed3cb --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/BillingSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Billing source. */ +public final class BillingSource extends ExpandableStringEnum { + /** Static value AZURE for BillingSource. */ + public static final BillingSource AZURE = fromString("AZURE"); + + /** Static value NEWRELIC for BillingSource. */ + public static final BillingSource NEWRELIC = fromString("NEWRELIC"); + + /** + * Creates a new instance of BillingSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BillingSource() { + } + + /** + * Creates or finds a BillingSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding BillingSource. + */ + @JsonCreator + public static BillingSource fromString(String name) { + return fromString(name, BillingSource.class); + } + + /** + * Gets known BillingSource values. + * + * @return known BillingSource values. + */ + public static Collection values() { + return values(BillingSource.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/FilteringTag.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/FilteringTag.java new file mode 100644 index 0000000000000..9c14652281aa7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/FilteringTag.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a filtering tag. Filtering tags are used for capturing resources and include/exclude them from + * being monitored. + */ +@Fluent +public final class FilteringTag { + /* + * The name (also known as the key) of the tag. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The value of the tag. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Valid actions for a filtering tag. Exclusion takes priority over inclusion. + */ + @JsonProperty(value = "action") + private TagAction action; + + /** Creates an instance of FilteringTag class. */ + public FilteringTag() { + } + + /** + * Get the name property: The name (also known as the key) of the tag. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name (also known as the key) of the tag. + * + * @param name the name value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the tag. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the tag. + * + * @param value the value value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @return the action value. + */ + public TagAction action() { + return this.action; + } + + /** + * Set the action property: Valid actions for a filtering tag. Exclusion takes priority over inclusion. + * + * @param action the action value to set. + * @return the FilteringTag object itself. + */ + public FilteringTag withAction(TagAction action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/HostsGetRequest.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/HostsGetRequest.java new file mode 100644 index 0000000000000..65832553ea045 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/HostsGetRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of a Hosts get Operation. */ +@Fluent +public final class HostsGetRequest { + /* + * VM resource IDs + */ + @JsonProperty(value = "vmIds") + private List vmIds; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of HostsGetRequest class. */ + public HostsGetRequest() { + } + + /** + * Get the vmIds property: VM resource IDs. + * + * @return the vmIds value. + */ + public List vmIds() { + return this.vmIds; + } + + /** + * Set the vmIds property: VM resource IDs. + * + * @param vmIds the vmIds value to set. + * @return the HostsGetRequest object itself. + */ + public HostsGetRequest withVmIds(List vmIds) { + this.vmIds = vmIds; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the HostsGetRequest object itself. + */ + public HostsGetRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model HostsGetRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(HostsGetRequest.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/LiftrResourceCategories.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/LiftrResourceCategories.java new file mode 100644 index 0000000000000..c54ff40cd482f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/LiftrResourceCategories.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Liftr Resource category. */ +public final class LiftrResourceCategories extends ExpandableStringEnum { + /** Static value Unknown for LiftrResourceCategories. */ + public static final LiftrResourceCategories UNKNOWN = fromString("Unknown"); + + /** Static value MonitorLogs for LiftrResourceCategories. */ + public static final LiftrResourceCategories MONITOR_LOGS = fromString("MonitorLogs"); + + /** + * Creates a new instance of LiftrResourceCategories value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public LiftrResourceCategories() { + } + + /** + * Creates or finds a LiftrResourceCategories from its string representation. + * + * @param name a name to look for. + * @return the corresponding LiftrResourceCategories. + */ + @JsonCreator + public static LiftrResourceCategories fromString(String name) { + return fromString(name, LiftrResourceCategories.class); + } + + /** + * Gets known LiftrResourceCategories values. + * + * @return known LiftrResourceCategories values. + */ + public static Collection values() { + return values(LiftrResourceCategories.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/LogRules.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/LogRules.java new file mode 100644 index 0000000000000..0a0528d2ea1e1 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/LogRules.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Set of rules for sending logs for the Monitor resource. */ +@Fluent +public final class LogRules { + /* + * Flag specifying if AAD logs should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendAadLogs") + private SendAadLogsStatus sendAadLogs; + + /* + * Flag specifying if subscription logs should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendSubscriptionLogs") + private SendSubscriptionLogsStatus sendSubscriptionLogs; + + /* + * Flag specifying if activity logs from Azure resources should be sent for the Monitor resource. + */ + @JsonProperty(value = "sendActivityLogs") + private SendActivityLogsStatus sendActivityLogs; + + /* + * List of filtering tags to be used for capturing logs. This only takes effect if SendActivityLogs flag is + * enabled. If empty, all resources will be captured. + * If only Exclude action is specified, the rules will apply to the list of all available resources. If Include + * actions are specified, the rules will only include resources with the associated tags. + */ + @JsonProperty(value = "filteringTags") + private List filteringTags; + + /** Creates an instance of LogRules class. */ + public LogRules() { + } + + /** + * Get the sendAadLogs property: Flag specifying if AAD logs should be sent for the Monitor resource. + * + * @return the sendAadLogs value. + */ + public SendAadLogsStatus sendAadLogs() { + return this.sendAadLogs; + } + + /** + * Set the sendAadLogs property: Flag specifying if AAD logs should be sent for the Monitor resource. + * + * @param sendAadLogs the sendAadLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendAadLogs(SendAadLogsStatus sendAadLogs) { + this.sendAadLogs = sendAadLogs; + return this; + } + + /** + * Get the sendSubscriptionLogs property: Flag specifying if subscription logs should be sent for the Monitor + * resource. + * + * @return the sendSubscriptionLogs value. + */ + public SendSubscriptionLogsStatus sendSubscriptionLogs() { + return this.sendSubscriptionLogs; + } + + /** + * Set the sendSubscriptionLogs property: Flag specifying if subscription logs should be sent for the Monitor + * resource. + * + * @param sendSubscriptionLogs the sendSubscriptionLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendSubscriptionLogs(SendSubscriptionLogsStatus sendSubscriptionLogs) { + this.sendSubscriptionLogs = sendSubscriptionLogs; + return this; + } + + /** + * Get the sendActivityLogs property: Flag specifying if activity logs from Azure resources should be sent for the + * Monitor resource. + * + * @return the sendActivityLogs value. + */ + public SendActivityLogsStatus sendActivityLogs() { + return this.sendActivityLogs; + } + + /** + * Set the sendActivityLogs property: Flag specifying if activity logs from Azure resources should be sent for the + * Monitor resource. + * + * @param sendActivityLogs the sendActivityLogs value to set. + * @return the LogRules object itself. + */ + public LogRules withSendActivityLogs(SendActivityLogsStatus sendActivityLogs) { + this.sendActivityLogs = sendActivityLogs; + return this; + } + + /** + * Get the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, + * the rules will apply to the list of all available resources. If Include actions are specified, the rules will + * only include resources with the associated tags. + * + * @return the filteringTags value. + */ + public List filteringTags() { + return this.filteringTags; + } + + /** + * Set the filteringTags property: List of filtering tags to be used for capturing logs. This only takes effect if + * SendActivityLogs flag is enabled. If empty, all resources will be captured. If only Exclude action is specified, + * the rules will apply to the list of all available resources. If Include actions are specified, the rules will + * only include resources with the associated tags. + * + * @param filteringTags the filteringTags value to set. + * @return the LogRules object itself. + */ + public LogRules withFilteringTags(List filteringTags) { + this.filteringTags = filteringTags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (filteringTags() != null) { + filteringTags().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ManagedServiceIdentity.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..b3167c58a3b23 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ManagedServiceIdentity.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.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public final class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys + * will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of ManagedServiceIdentity class. */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ManagedServiceIdentityType.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..02760709a0322 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ManagedServiceIdentityType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** Static value None for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** Static value SystemAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** Static value UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** Static value SystemAssigned, UserAssigned for ManagedServiceIdentityType. */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED = + fromString("SystemAssigned, UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MarketplaceSubscriptionStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MarketplaceSubscriptionStatus.java new file mode 100644 index 0000000000000..4582223ce86b0 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MarketplaceSubscriptionStatus.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Flag specifying the Marketplace Subscription Status of the resource. If payment is not made in time, the resource + * will go in Suspended state. + */ +public final class MarketplaceSubscriptionStatus extends ExpandableStringEnum { + /** Static value Active for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus ACTIVE = fromString("Active"); + + /** Static value Suspended for MarketplaceSubscriptionStatus. */ + public static final MarketplaceSubscriptionStatus SUSPENDED = fromString("Suspended"); + + /** + * Creates a new instance of MarketplaceSubscriptionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MarketplaceSubscriptionStatus() { + } + + /** + * Creates or finds a MarketplaceSubscriptionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MarketplaceSubscriptionStatus. + */ + @JsonCreator + public static MarketplaceSubscriptionStatus fromString(String name) { + return fromString(name, MarketplaceSubscriptionStatus.class); + } + + /** + * Gets known MarketplaceSubscriptionStatus values. + * + * @return known MarketplaceSubscriptionStatus values. + */ + public static Collection values() { + return values(MarketplaceSubscriptionStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricRules.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricRules.java new file mode 100644 index 0000000000000..0c465db5300af --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricRules.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import java.util.List; + +/** An immutable client-side representation of MetricRules. */ +public interface MetricRules { + /** + * Gets the sendMetrics property: Flag specifying if metrics should be sent for the Monitor resource. + * + * @return the sendMetrics value. + */ + SendMetricsStatus sendMetrics(); + + /** + * Gets the filteringTags property: List of filtering tags to be used for capturing metrics. + * + * @return the filteringTags value. + */ + List filteringTags(); + + /** + * Gets the userEmail property: User Email. + * + * @return the userEmail value. + */ + String userEmail(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner object. + * + * @return the inner object. + */ + MetricRulesInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsRequest.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsRequest.java new file mode 100644 index 0000000000000..81635202807bf --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsRequest.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.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request of get metrics Operation. */ +@Fluent +public final class MetricsRequest { + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of MetricsRequest class. */ + public MetricsRequest() { + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the MetricsRequest object itself. + */ + public MetricsRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model MetricsRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricsRequest.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsStatusRequest.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsStatusRequest.java new file mode 100644 index 0000000000000..241f3542c93bc --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsStatusRequest.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Request of get metrics status Operation. */ +@Fluent +public final class MetricsStatusRequest { + /* + * Azure resource IDs + */ + @JsonProperty(value = "azureResourceIds") + private List azureResourceIds; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of MetricsStatusRequest class. */ + public MetricsStatusRequest() { + } + + /** + * Get the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + public List azureResourceIds() { + return this.azureResourceIds; + } + + /** + * Set the azureResourceIds property: Azure resource IDs. + * + * @param azureResourceIds the azureResourceIds value to set. + * @return the MetricsStatusRequest object itself. + */ + public MetricsStatusRequest withAzureResourceIds(List azureResourceIds) { + this.azureResourceIds = azureResourceIds; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the MetricsStatusRequest object itself. + */ + public MetricsStatusRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model MetricsStatusRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricsStatusRequest.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsStatusResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsStatusResponse.java new file mode 100644 index 0000000000000..d23ba424f7b83 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MetricsStatusResponse.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner; +import java.util.List; + +/** An immutable client-side representation of MetricsStatusResponse. */ +public interface MetricsStatusResponse { + /** + * Gets the azureResourceIds property: Azure resource IDs. + * + * @return the azureResourceIds value. + */ + List azureResourceIds(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner object. + * + * @return the inner object. + */ + MetricsStatusResponseInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoredResource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoredResource.java new file mode 100644 index 0000000000000..c442d07991839 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoredResource.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; + +/** An immutable client-side representation of MonitoredResource. */ +public interface MonitoredResource { + /** + * Gets the id property: The ARM id of the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the sendingMetrics property: Flag indicating if resource is sending metrics to NewRelic. + * + * @return the sendingMetrics value. + */ + SendingMetricsStatus sendingMetrics(); + + /** + * Gets the reasonForMetricsStatus property: Reason for why the resource is sending metrics (or why it is not + * sending). + * + * @return the reasonForMetricsStatus value. + */ + String reasonForMetricsStatus(); + + /** + * Gets the sendingLogs property: Flag indicating if resource is sending logs to NewRelic. + * + * @return the sendingLogs value. + */ + SendingLogsStatus sendingLogs(); + + /** + * Gets the reasonForLogsStatus property: Reason for why the resource is sending logs (or why it is not sending). + * + * @return the reasonForLogsStatus value. + */ + String reasonForLogsStatus(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner object. + * + * @return the inner object. + */ + MonitoredResourceInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoredResourceListResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoredResourceListResponse.java new file mode 100644 index 0000000000000..2f44447c2b0b7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoredResourceListResponse.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of all the resources being monitored by NewRelic monitor resource. */ +@Fluent +public final class MonitoredResourceListResponse { + /* + * The MonitoredResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of MonitoredResourceListResponse class. */ + public MonitoredResourceListResponse() { + } + + /** + * Get the value property: The MonitoredResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The MonitoredResource items on this page. + * + * @param value the value value to set. + * @return the MonitoredResourceListResponse object itself. + */ + public MonitoredResourceListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the MonitoredResourceListResponse object itself. + */ + public MonitoredResourceListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model MonitoredResourceListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitoredResourceListResponse.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoringStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoringStatus.java new file mode 100644 index 0000000000000..84043394b5be7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoringStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Flag specifying if the resource monitoring is enabled or disabled. */ +public final class MonitoringStatus extends ExpandableStringEnum { + /** Static value Enabled for MonitoringStatus. */ + public static final MonitoringStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for MonitoringStatus. */ + public static final MonitoringStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of MonitoringStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MonitoringStatus() { + } + + /** + * Creates or finds a MonitoringStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding MonitoringStatus. + */ + @JsonCreator + public static MonitoringStatus fromString(String name) { + return fromString(name, MonitoringStatus.class); + } + + /** + * Gets known MonitoringStatus values. + * + * @return known MonitoringStatus values. + */ + public static Collection values() { + return values(MonitoringStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoringTagRulesProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoringTagRulesProperties.java new file mode 100644 index 0000000000000..7ce41d44e85c7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/MonitoringTagRulesProperties.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoringTagRulesPropertiesInner; + +/** An immutable client-side representation of MonitoringTagRulesProperties. */ +public interface MonitoringTagRulesProperties { + /** + * Gets the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoringTagRulesPropertiesInner + * object. + * + * @return the inner object. + */ + MonitoringTagRulesPropertiesInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Monitors.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Monitors.java new file mode 100644 index 0000000000000..22569267b22d3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Monitors.java @@ -0,0 +1,335 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.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 Monitors. */ +public interface Monitors { + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List NewRelicMonitorResource resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List NewRelicMonitorResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NewRelicMonitorResource list operation as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Get a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource. + */ + NewRelicMonitorResource getByResourceGroup(String resourceGroupName, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors 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 userEmail, String monitorName); + + /** + * Delete a NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param userEmail User Email. + * @param monitorName Name of the Monitors resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String userEmail, String monitorName, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules along with {@link Response}. + */ + Response getMetricRulesWithResponse( + String resourceGroupName, String monitorName, MetricsRequest request, Context context); + + /** + * Get metric rules. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules. + */ + MetricRules getMetricRules(String resourceGroupName, String monitorName, MetricsRequest request); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status along with {@link Response}. + */ + Response getMetricStatusWithResponse( + String resourceGroupName, String monitorName, MetricsStatusRequest request, Context context); + + /** + * Get metric status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status. + */ + MetricsStatusResponse getMetricStatus(String resourceGroupName, String monitorName, MetricsStatusRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the app services get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices( + String resourceGroupName, String monitorName, AppServicesGetRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response switchBillingWithResponse( + String resourceGroupName, String monitorName, SwitchBillingRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the switch billing request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void switchBilling(String resourceGroupName, String monitorName, SwitchBillingRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts(String resourceGroupName, String monitorName, HostsGetRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param request The details of the Hosts get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts( + String resourceGroupName, String monitorName, HostsGetRequest request, Context context); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources(String resourceGroupName, String monitorName); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent along with {@link Response}. + */ + Response vmHostPayloadWithResponse( + String resourceGroupName, String monitorName, Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 response of payload to be passed while installing VM agent. + */ + VMExtensionPayload vmHostPayload(String resourceGroupName, String monitorName); + + /** + * Get a NewRelicMonitorResource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + NewRelicMonitorResource getById(String id); + + /** + * Get a NewRelicMonitorResource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NewRelicMonitorResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NewRelicMonitorResource resource. + * + * @param name resource name. + * @return the first stage of the new NewRelicMonitorResource definition. + */ + NewRelicMonitorResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicAccountProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicAccountProperties.java new file mode 100644 index 0000000000000..9957e06e3b0d8 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicAccountProperties.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the NewRelic account. */ +@Fluent +public final class NewRelicAccountProperties { + /* + * User id + */ + @JsonProperty(value = "userId") + private String userId; + + /* + * NewRelic Account Information + */ + @JsonProperty(value = "accountInfo") + private AccountInfo accountInfo; + + /* + * NewRelic Organization Information + */ + @JsonProperty(value = "organizationInfo") + private OrganizationInfo organizationInfo; + + /* + * date when plan was applied + */ + @JsonProperty(value = "singleSignOnProperties") + private NewRelicSingleSignOnProperties singleSignOnProperties; + + /** Creates an instance of NewRelicAccountProperties class. */ + public NewRelicAccountProperties() { + } + + /** + * Get the userId property: User id. + * + * @return the userId value. + */ + public String userId() { + return this.userId; + } + + /** + * Set the userId property: User id. + * + * @param userId the userId value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withUserId(String userId) { + this.userId = userId; + return this; + } + + /** + * Get the accountInfo property: NewRelic Account Information. + * + * @return the accountInfo value. + */ + public AccountInfo accountInfo() { + return this.accountInfo; + } + + /** + * Set the accountInfo property: NewRelic Account Information. + * + * @param accountInfo the accountInfo value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withAccountInfo(AccountInfo accountInfo) { + this.accountInfo = accountInfo; + return this; + } + + /** + * Get the organizationInfo property: NewRelic Organization Information. + * + * @return the organizationInfo value. + */ + public OrganizationInfo organizationInfo() { + return this.organizationInfo; + } + + /** + * Set the organizationInfo property: NewRelic Organization Information. + * + * @param organizationInfo the organizationInfo value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withOrganizationInfo(OrganizationInfo organizationInfo) { + this.organizationInfo = organizationInfo; + return this; + } + + /** + * Get the singleSignOnProperties property: date when plan was applied. + * + * @return the singleSignOnProperties value. + */ + public NewRelicSingleSignOnProperties singleSignOnProperties() { + return this.singleSignOnProperties; + } + + /** + * Set the singleSignOnProperties property: date when plan was applied. + * + * @param singleSignOnProperties the singleSignOnProperties value to set. + * @return the NewRelicAccountProperties object itself. + */ + public NewRelicAccountProperties withSingleSignOnProperties(NewRelicSingleSignOnProperties singleSignOnProperties) { + this.singleSignOnProperties = singleSignOnProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (accountInfo() != null) { + accountInfo().validate(); + } + if (organizationInfo() != null) { + organizationInfo().validate(); + } + if (singleSignOnProperties() != null) { + singleSignOnProperties().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResource.java new file mode 100644 index 0000000000000..423a21b507b75 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResource.java @@ -0,0 +1,583 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import java.util.Map; + +/** An immutable client-side representation of NewRelicMonitorResource. */ +public interface NewRelicMonitorResource { + /** + * 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 identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the monitoringStatus property: MonitoringStatus of the resource. + * + * @return the monitoringStatus value. + */ + MonitoringStatus monitoringStatus(); + + /** + * Gets the marketplaceSubscriptionStatus property: NewRelic Organization properties of the resource. + * + * @return the marketplaceSubscriptionStatus value. + */ + MarketplaceSubscriptionStatus marketplaceSubscriptionStatus(); + + /** + * Gets the marketplaceSubscriptionId property: Marketplace Subscription Id. + * + * @return the marketplaceSubscriptionId value. + */ + String marketplaceSubscriptionId(); + + /** + * Gets the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + NewRelicAccountProperties newRelicAccountProperties(); + + /** + * Gets the userInfo property: User Info. + * + * @return the userInfo value. + */ + UserInfo userInfo(); + + /** + * Gets the planData property: Plan details. + * + * @return the planData value. + */ + PlanData planData(); + + /** + * Gets the liftrResourceCategory property: Liftr resource category. + * + * @return the liftrResourceCategory value. + */ + LiftrResourceCategories liftrResourceCategory(); + + /** + * Gets the liftrResourcePreference property: Liftr resource preference. The priority of the resource. + * + * @return the liftrResourcePreference value. + */ + Integer liftrResourcePreference(); + + /** + * Gets the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + OrgCreationSource orgCreationSource(); + + /** + * Gets the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + AccountCreationSource accountCreationSource(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner object. + * + * @return the inner object. + */ + NewRelicMonitorResourceInner innerModel(); + + /** The entirety of the NewRelicMonitorResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The NewRelicMonitorResource definition stages. */ + interface DefinitionStages { + /** The first stage of the NewRelicMonitorResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the NewRelicMonitorResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the NewRelicMonitorResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithNewRelicAccountProperties, + DefinitionStages.WithUserInfo, + DefinitionStages.WithPlanData, + DefinitionStages.WithOrgCreationSource, + DefinitionStages.WithAccountCreationSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + NewRelicMonitorResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NewRelicMonitorResource create(Context context); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify newRelicAccountProperties. */ + interface WithNewRelicAccountProperties { + /** + * Specifies the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties MarketplaceSubscriptionStatus of the resource. + * @return the next definition stage. + */ + WithCreate withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify userInfo. */ + interface WithUserInfo { + /** + * Specifies the userInfo property: User Info. + * + * @param userInfo User Info. + * @return the next definition stage. + */ + WithCreate withUserInfo(UserInfo userInfo); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify planData. */ + interface WithPlanData { + /** + * Specifies the planData property: Plan details. + * + * @param planData Plan details. + * @return the next definition stage. + */ + WithCreate withPlanData(PlanData planData); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify orgCreationSource. */ + interface WithOrgCreationSource { + /** + * Specifies the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource Source of org creation. + * @return the next definition stage. + */ + WithCreate withOrgCreationSource(OrgCreationSource orgCreationSource); + } + /** The stage of the NewRelicMonitorResource definition allowing to specify accountCreationSource. */ + interface WithAccountCreationSource { + /** + * Specifies the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource Source of account creation. + * @return the next definition stage. + */ + WithCreate withAccountCreationSource(AccountCreationSource accountCreationSource); + } + } + /** + * Begins update for the NewRelicMonitorResource resource. + * + * @return the stage of resource update. + */ + NewRelicMonitorResource.Update update(); + + /** The template for NewRelicMonitorResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithNewRelicAccountProperties, + UpdateStages.WithUserInfo, + UpdateStages.WithPlanData, + UpdateStages.WithOrgCreationSource, + UpdateStages.WithAccountCreationSource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NewRelicMonitorResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NewRelicMonitorResource apply(Context context); + } + /** The NewRelicMonitorResource update stages. */ + interface UpdateStages { + /** The stage of the NewRelicMonitorResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the NewRelicMonitorResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + /** The stage of the NewRelicMonitorResource update allowing to specify newRelicAccountProperties. */ + interface WithNewRelicAccountProperties { + /** + * Specifies the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties MarketplaceSubscriptionStatus of the resource. + * @return the next definition stage. + */ + Update withNewRelicAccountProperties(NewRelicAccountProperties newRelicAccountProperties); + } + /** The stage of the NewRelicMonitorResource update allowing to specify userInfo. */ + interface WithUserInfo { + /** + * Specifies the userInfo property: User Info. + * + * @param userInfo User Info. + * @return the next definition stage. + */ + Update withUserInfo(UserInfo userInfo); + } + /** The stage of the NewRelicMonitorResource update allowing to specify planData. */ + interface WithPlanData { + /** + * Specifies the planData property: Plan details. + * + * @param planData Plan details. + * @return the next definition stage. + */ + Update withPlanData(PlanData planData); + } + /** The stage of the NewRelicMonitorResource update allowing to specify orgCreationSource. */ + interface WithOrgCreationSource { + /** + * Specifies the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource Source of org creation. + * @return the next definition stage. + */ + Update withOrgCreationSource(OrgCreationSource orgCreationSource); + } + /** The stage of the NewRelicMonitorResource update allowing to specify accountCreationSource. */ + interface WithAccountCreationSource { + /** + * Specifies the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource Source of account creation. + * @return the next definition stage. + */ + Update withAccountCreationSource(AccountCreationSource accountCreationSource); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NewRelicMonitorResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NewRelicMonitorResource refresh(Context context); + + /** + * Get metric rules. + * + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules along with {@link Response}. + */ + Response getMetricRulesWithResponse(MetricsRequest request, Context context); + + /** + * Get metric rules. + * + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric rules. + */ + MetricRules getMetricRules(MetricsRequest request); + + /** + * Get metric status. + * + * @param request The details of the get metrics status request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status along with {@link Response}. + */ + Response getMetricStatusWithResponse(MetricsStatusRequest request, Context context); + + /** + * Get metric status. + * + * @param request The details of the get metrics status request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metric status. + */ + MetricsStatusResponse getMetricStatus(MetricsStatusRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param request The details of the app services get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices(AppServicesGetRequest request); + + /** + * List the app service resources currently being monitored by the NewRelic resource. + * + * @param request The details of the app services get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list app services Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listAppServices(AppServicesGetRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param request The details of the switch billing request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response switchBillingWithResponse(SwitchBillingRequest request, Context context); + + /** + * Switches the billing for NewRelic monitor resource. + * + * @param request The details of the switch billing request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void switchBilling(SwitchBillingRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param request The details of the Hosts get request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts(HostsGetRequest request); + + /** + * List the compute vm resources currently being monitored by the NewRelic resource. + * + * @param request The details of the Hosts get request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return response of a list VM Host Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listHosts(HostsGetRequest request, Context context); + + /** + * List the resources currently being monitored by the NewRelic monitor resource. + * + * @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 all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources(); + + /** + * List the resources currently being monitored by the NewRelic monitor 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 list of all the resources being monitored by NewRelic monitor resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listMonitoredResources(Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @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 response of payload to be passed while installing VM agent along with {@link Response}. + */ + Response vmHostPayloadWithResponse(Context context); + + /** + * Returns the payload that needs to be passed in the request body for installing NewRelic agent on a VM. + * + * @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 response of payload to be passed while installing VM agent. + */ + VMExtensionPayload vmHostPayload(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResourceListResult.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResourceListResult.java new file mode 100644 index 0000000000000..8456cc9e70990 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResourceListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a NewRelicMonitorResource list operation. */ +@Fluent +public final class NewRelicMonitorResourceListResult { + /* + * The NewRelicMonitorResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of NewRelicMonitorResourceListResult class. */ + public NewRelicMonitorResourceListResult() { + } + + /** + * Get the value property: The NewRelicMonitorResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The NewRelicMonitorResource items on this page. + * + * @param value the value value to set. + * @return the NewRelicMonitorResourceListResult object itself. + */ + public NewRelicMonitorResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the NewRelicMonitorResourceListResult object itself. + */ + public NewRelicMonitorResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model NewRelicMonitorResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NewRelicMonitorResourceListResult.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResourceUpdate.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResourceUpdate.java new file mode 100644 index 0000000000000..7d1a305813433 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicMonitorResourceUpdate.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceUpdateProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The type used for update operations of the NewRelicMonitorResource. */ +@Fluent +public final class NewRelicMonitorResourceUpdate { + /* + * The managed service identities assigned to this resource. + */ + @JsonProperty(value = "identity") + private ManagedServiceIdentity identity; + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The updatable properties of the NewRelicMonitorResource. + */ + @JsonProperty(value = "properties") + private NewRelicMonitorResourceUpdateProperties innerProperties; + + /** Creates an instance of NewRelicMonitorResourceUpdate class. */ + public NewRelicMonitorResourceUpdate() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The updatable properties of the NewRelicMonitorResource. + * + * @return the innerProperties value. + */ + private NewRelicMonitorResourceUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @return the newRelicAccountProperties value. + */ + public NewRelicAccountProperties newRelicAccountProperties() { + return this.innerProperties() == null ? null : this.innerProperties().newRelicAccountProperties(); + } + + /** + * Set the newRelicAccountProperties property: MarketplaceSubscriptionStatus of the resource. + * + * @param newRelicAccountProperties the newRelicAccountProperties value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withNewRelicAccountProperties( + NewRelicAccountProperties newRelicAccountProperties) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withNewRelicAccountProperties(newRelicAccountProperties); + return this; + } + + /** + * Get the userInfo property: User Info. + * + * @return the userInfo value. + */ + public UserInfo userInfo() { + return this.innerProperties() == null ? null : this.innerProperties().userInfo(); + } + + /** + * Set the userInfo property: User Info. + * + * @param userInfo the userInfo value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withUserInfo(UserInfo userInfo) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withUserInfo(userInfo); + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.innerProperties() == null ? null : this.innerProperties().planData(); + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withPlanData(PlanData planData) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withPlanData(planData); + return this; + } + + /** + * Get the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + public OrgCreationSource orgCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().orgCreationSource(); + } + + /** + * Set the orgCreationSource property: Source of org creation. + * + * @param orgCreationSource the orgCreationSource value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withOrgCreationSource(OrgCreationSource orgCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withOrgCreationSource(orgCreationSource); + return this; + } + + /** + * Get the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + public AccountCreationSource accountCreationSource() { + return this.innerProperties() == null ? null : this.innerProperties().accountCreationSource(); + } + + /** + * Set the accountCreationSource property: Source of account creation. + * + * @param accountCreationSource the accountCreationSource value to set. + * @return the NewRelicMonitorResourceUpdate object itself. + */ + public NewRelicMonitorResourceUpdate withAccountCreationSource(AccountCreationSource accountCreationSource) { + if (this.innerProperties() == null) { + this.innerProperties = new NewRelicMonitorResourceUpdateProperties(); + } + this.innerProperties().withAccountCreationSource(accountCreationSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicSingleSignOnProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicSingleSignOnProperties.java new file mode 100644 index 0000000000000..fb76f04353517 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/NewRelicSingleSignOnProperties.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.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Single sign on Info of the NewRelic account. */ +@Fluent +public final class NewRelicSingleSignOnProperties { + /* + * Single sign-on state + */ + @JsonProperty(value = "singleSignOnState") + private SingleSignOnStates singleSignOnState; + + /* + * The Id of the Enterprise App used for Single sign-on. + */ + @JsonProperty(value = "enterpriseAppId") + private String enterpriseAppId; + + /* + * The login URL specific to this NewRelic Organization + */ + @JsonProperty(value = "singleSignOnUrl") + private String singleSignOnUrl; + + /* + * Provisioning state + */ + @JsonProperty(value = "provisioningState") + private ProvisioningState provisioningState; + + /** Creates an instance of NewRelicSingleSignOnProperties class. */ + public NewRelicSingleSignOnProperties() { + } + + /** + * Get the singleSignOnState property: Single sign-on state. + * + * @return the singleSignOnState value. + */ + public SingleSignOnStates singleSignOnState() { + return this.singleSignOnState; + } + + /** + * Set the singleSignOnState property: Single sign-on state. + * + * @param singleSignOnState the singleSignOnState value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withSingleSignOnState(SingleSignOnStates singleSignOnState) { + this.singleSignOnState = singleSignOnState; + return this; + } + + /** + * Get the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @return the enterpriseAppId value. + */ + public String enterpriseAppId() { + return this.enterpriseAppId; + } + + /** + * Set the enterpriseAppId property: The Id of the Enterprise App used for Single sign-on. + * + * @param enterpriseAppId the enterpriseAppId value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withEnterpriseAppId(String enterpriseAppId) { + this.enterpriseAppId = enterpriseAppId; + return this; + } + + /** + * Get the singleSignOnUrl property: The login URL specific to this NewRelic Organization. + * + * @return the singleSignOnUrl value. + */ + public String singleSignOnUrl() { + return this.singleSignOnUrl; + } + + /** + * Set the singleSignOnUrl property: The login URL specific to this NewRelic Organization. + * + * @param singleSignOnUrl the singleSignOnUrl value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withSingleSignOnUrl(String singleSignOnUrl) { + this.singleSignOnUrl = singleSignOnUrl; + return this; + } + + /** + * Get the provisioningState property: Provisioning state. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the NewRelicSingleSignOnProperties object itself. + */ + public NewRelicSingleSignOnProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Operation.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Operation.java new file mode 100644 index 0000000000000..4e0bc20729565 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Operation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OperationDisplay.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OperationDisplay.java new file mode 100644 index 0000000000000..1a883f178bdfe --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OperationDisplay.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplay { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OperationListResult.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OperationListResult.java new file mode 100644 index 0000000000000..22e5c76da7911 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OperationListResult.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.newrelicobservability.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResult class. */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Operations.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Operations.java new file mode 100644 index 0000000000000..d6f787c73e1a0 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Operations.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.newrelicobservability.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrgCreationSource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrgCreationSource.java new file mode 100644 index 0000000000000..7c4a4fa0fc60a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrgCreationSource.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Source of Org creation. */ +public final class OrgCreationSource extends ExpandableStringEnum { + /** Static value LIFTR for OrgCreationSource. */ + public static final OrgCreationSource LIFTR = fromString("LIFTR"); + + /** Static value NEWRELIC for OrgCreationSource. */ + public static final OrgCreationSource NEWRELIC = fromString("NEWRELIC"); + + /** + * Creates a new instance of OrgCreationSource value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OrgCreationSource() { + } + + /** + * Creates or finds a OrgCreationSource from its string representation. + * + * @param name a name to look for. + * @return the corresponding OrgCreationSource. + */ + @JsonCreator + public static OrgCreationSource fromString(String name) { + return fromString(name, OrgCreationSource.class); + } + + /** + * Gets known OrgCreationSource values. + * + * @return known OrgCreationSource values. + */ + public static Collection values() { + return values(OrgCreationSource.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationInfo.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationInfo.java new file mode 100644 index 0000000000000..4e55b4ebcf9ff --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationInfo.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Organization Info of the NewRelic account. */ +@Fluent +public final class OrganizationInfo { + /* + * Organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /** Creates an instance of OrganizationInfo class. */ + public OrganizationInfo() { + } + + /** + * Get the organizationId property: Organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization id. + * + * @param organizationId the organizationId value to set. + * @return the OrganizationInfo object itself. + */ + public OrganizationInfo withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationResource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationResource.java new file mode 100644 index 0000000000000..05e6bb377c641 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationResource.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.newrelicobservability.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; + +/** An immutable client-side representation of OrganizationResource. */ +public interface OrganizationResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the organizationId property: organization id. + * + * @return the organizationId value. + */ + String organizationId(); + + /** + * Gets the organizationName property: organization name. + * + * @return the organizationName value. + */ + String organizationName(); + + /** + * Gets the billingSource property: Billing source. + * + * @return the billingSource value. + */ + BillingSource billingSource(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner object. + * + * @return the inner object. + */ + OrganizationResourceInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Organizations.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Organizations.java new file mode 100644 index 0000000000000..bd2e6d2483f5f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Organizations.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.newrelicobservability.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Organizations. */ +public interface Organizations { + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location); + + /** + * List all the existing organizations. + * + * @param userEmail User Email. + * @param location Location for NewRelic. + * @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 response of get all organizations Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String userEmail, String location, Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationsListResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationsListResponse.java new file mode 100644 index 0000000000000..489abe9dec3a5 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/OrganizationsListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get all organizations Operation. */ +@Fluent +public final class OrganizationsListResponse { + /* + * The OrganizationResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of OrganizationsListResponse class. */ + public OrganizationsListResponse() { + } + + /** + * Get the value property: The OrganizationResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The OrganizationResource items on this page. + * + * @param value the value value to set. + * @return the OrganizationsListResponse object itself. + */ + public OrganizationsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the OrganizationsListResponse object itself. + */ + public OrganizationsListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model OrganizationsListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OrganizationsListResponse.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Origin.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Origin.java new file mode 100644 index 0000000000000..fa768b1775524 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Origin.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.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanData.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanData.java new file mode 100644 index 0000000000000..1317958829e1a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanData.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Plan data of NewRelic Monitor resource. */ +@Fluent +public final class PlanData { + /* + * Different usage type like PAYG/COMMITTED. this could be enum + */ + @JsonProperty(value = "usageType") + private UsageType usageType; + + /* + * Different billing cycles like MONTHLY/WEEKLY. this could be enum + */ + @JsonProperty(value = "billingCycle") + private BillingCycle billingCycle; + + /* + * plan id as published by NewRelic + */ + @JsonProperty(value = "planDetails") + private String planDetails; + + /* + * date when plan was applied + */ + @JsonProperty(value = "effectiveDate") + private OffsetDateTime effectiveDate; + + /** Creates an instance of PlanData class. */ + public PlanData() { + } + + /** + * Get the usageType property: Different usage type like PAYG/COMMITTED. this could be enum. + * + * @return the usageType value. + */ + public UsageType usageType() { + return this.usageType; + } + + /** + * Set the usageType property: Different usage type like PAYG/COMMITTED. this could be enum. + * + * @param usageType the usageType value to set. + * @return the PlanData object itself. + */ + public PlanData withUsageType(UsageType usageType) { + this.usageType = usageType; + return this; + } + + /** + * Get the billingCycle property: Different billing cycles like MONTHLY/WEEKLY. this could be enum. + * + * @return the billingCycle value. + */ + public BillingCycle billingCycle() { + return this.billingCycle; + } + + /** + * Set the billingCycle property: Different billing cycles like MONTHLY/WEEKLY. this could be enum. + * + * @param billingCycle the billingCycle value to set. + * @return the PlanData object itself. + */ + public PlanData withBillingCycle(BillingCycle billingCycle) { + this.billingCycle = billingCycle; + return this; + } + + /** + * Get the planDetails property: plan id as published by NewRelic. + * + * @return the planDetails value. + */ + public String planDetails() { + return this.planDetails; + } + + /** + * Set the planDetails property: plan id as published by NewRelic. + * + * @param planDetails the planDetails value to set. + * @return the PlanData object itself. + */ + public PlanData withPlanDetails(String planDetails) { + this.planDetails = planDetails; + return this; + } + + /** + * Get the effectiveDate property: date when plan was applied. + * + * @return the effectiveDate value. + */ + public OffsetDateTime effectiveDate() { + return this.effectiveDate; + } + + /** + * Set the effectiveDate property: date when plan was applied. + * + * @param effectiveDate the effectiveDate value to set. + * @return the PlanData object itself. + */ + public PlanData withEffectiveDate(OffsetDateTime effectiveDate) { + this.effectiveDate = effectiveDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanDataListResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanDataListResponse.java new file mode 100644 index 0000000000000..250d852597fe0 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanDataListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of get all plan data Operation. */ +@Fluent +public final class PlanDataListResponse { + /* + * The PlanDataResource items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of PlanDataListResponse class. */ + public PlanDataListResponse() { + } + + /** + * Get the value property: The PlanDataResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The PlanDataResource items on this page. + * + * @param value the value value to set. + * @return the PlanDataListResponse object itself. + */ + public PlanDataListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PlanDataListResponse object itself. + */ + public PlanDataListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model PlanDataListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PlanDataListResponse.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanDataResource.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanDataResource.java new file mode 100644 index 0000000000000..9082254c41831 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/PlanDataResource.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.newrelicobservability.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; + +/** An immutable client-side representation of PlanDataResource. */ +public interface PlanDataResource { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the planData property: Plan details. + * + * @return the planData value. + */ + PlanData planData(); + + /** + * Gets the orgCreationSource property: Source of org creation. + * + * @return the orgCreationSource value. + */ + OrgCreationSource orgCreationSource(); + + /** + * Gets the accountCreationSource property: Source of account creation. + * + * @return the accountCreationSource value. + */ + AccountCreationSource accountCreationSource(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner object. + * + * @return the inner object. + */ + PlanDataResourceInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Plans.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Plans.java new file mode 100644 index 0000000000000..37ec8e453fc3f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/Plans.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.newrelicobservability.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Plans. */ +public interface Plans { + /** + * List plans data. + * + * @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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List plans data. + * + * @param accountId Account Id. + * @param organizationId Organization 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 response of get all plan data Operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String accountId, String organizationId, Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ProvisioningState.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ProvisioningState.java new file mode 100644 index 0000000000000..067bc104a45ca --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/ProvisioningState.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Provisioning State of the Monitor resource. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Accepted for ProvisioningState. */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Deleted for ProvisioningState. */ + public static final ProvisioningState DELETED = fromString("Deleted"); + + /** Static value NotSpecified for ProvisioningState. */ + public static final ProvisioningState NOT_SPECIFIED = fromString("NotSpecified"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendAadLogsStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendAadLogsStatus.java new file mode 100644 index 0000000000000..d5597533b8603 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendAadLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether AAD logs are being sent. */ +public final class SendAadLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendAadLogsStatus. */ + public static final SendAadLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendAadLogsStatus. */ + public static final SendAadLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendAadLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendAadLogsStatus() { + } + + /** + * Creates or finds a SendAadLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendAadLogsStatus. + */ + @JsonCreator + public static SendAadLogsStatus fromString(String name) { + return fromString(name, SendAadLogsStatus.class); + } + + /** + * Gets known SendAadLogsStatus values. + * + * @return known SendAadLogsStatus values. + */ + public static Collection values() { + return values(SendAadLogsStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendActivityLogsStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendActivityLogsStatus.java new file mode 100644 index 0000000000000..ad2ccd83738b2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendActivityLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether activity logs are being sent. */ +public final class SendActivityLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendActivityLogsStatus. */ + public static final SendActivityLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendActivityLogsStatus. */ + public static final SendActivityLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendActivityLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendActivityLogsStatus() { + } + + /** + * Creates or finds a SendActivityLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendActivityLogsStatus. + */ + @JsonCreator + public static SendActivityLogsStatus fromString(String name) { + return fromString(name, SendActivityLogsStatus.class); + } + + /** + * Gets known SendActivityLogsStatus values. + * + * @return known SendActivityLogsStatus values. + */ + public static Collection values() { + return values(SendActivityLogsStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendMetricsStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendMetricsStatus.java new file mode 100644 index 0000000000000..86316bd5643ac --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendMetricsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether metrics are being sent. */ +public final class SendMetricsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendMetricsStatus. */ + public static final SendMetricsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendMetricsStatus. */ + public static final SendMetricsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendMetricsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendMetricsStatus() { + } + + /** + * Creates or finds a SendMetricsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendMetricsStatus. + */ + @JsonCreator + public static SendMetricsStatus fromString(String name) { + return fromString(name, SendMetricsStatus.class); + } + + /** + * Gets known SendMetricsStatus values. + * + * @return known SendMetricsStatus values. + */ + public static Collection values() { + return values(SendMetricsStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendSubscriptionLogsStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendSubscriptionLogsStatus.java new file mode 100644 index 0000000000000..23b5400c6ce58 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendSubscriptionLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether subscription logs are being sent. */ +public final class SendSubscriptionLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendSubscriptionLogsStatus. */ + public static final SendSubscriptionLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendSubscriptionLogsStatus. */ + public static final SendSubscriptionLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendSubscriptionLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendSubscriptionLogsStatus() { + } + + /** + * Creates or finds a SendSubscriptionLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendSubscriptionLogsStatus. + */ + @JsonCreator + public static SendSubscriptionLogsStatus fromString(String name) { + return fromString(name, SendSubscriptionLogsStatus.class); + } + + /** + * Gets known SendSubscriptionLogsStatus values. + * + * @return known SendSubscriptionLogsStatus values. + */ + public static Collection values() { + return values(SendSubscriptionLogsStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendingLogsStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendingLogsStatus.java new file mode 100644 index 0000000000000..da558d59ae8de --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendingLogsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether logs are being sent. */ +public final class SendingLogsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendingLogsStatus. */ + public static final SendingLogsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendingLogsStatus. */ + public static final SendingLogsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendingLogsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendingLogsStatus() { + } + + /** + * Creates or finds a SendingLogsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendingLogsStatus. + */ + @JsonCreator + public static SendingLogsStatus fromString(String name) { + return fromString(name, SendingLogsStatus.class); + } + + /** + * Gets known SendingLogsStatus values. + * + * @return known SendingLogsStatus values. + */ + public static Collection values() { + return values(SendingLogsStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendingMetricsStatus.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendingMetricsStatus.java new file mode 100644 index 0000000000000..6cc855315bc75 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SendingMetricsStatus.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates whether metrics are being sent. */ +public final class SendingMetricsStatus extends ExpandableStringEnum { + /** Static value Enabled for SendingMetricsStatus. */ + public static final SendingMetricsStatus ENABLED = fromString("Enabled"); + + /** Static value Disabled for SendingMetricsStatus. */ + public static final SendingMetricsStatus DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of SendingMetricsStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SendingMetricsStatus() { + } + + /** + * Creates or finds a SendingMetricsStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding SendingMetricsStatus. + */ + @JsonCreator + public static SendingMetricsStatus fromString(String name) { + return fromString(name, SendingMetricsStatus.class); + } + + /** + * Gets known SendingMetricsStatus values. + * + * @return known SendingMetricsStatus values. + */ + public static Collection values() { + return values(SendingMetricsStatus.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SingleSignOnStates.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SingleSignOnStates.java new file mode 100644 index 0000000000000..6f6faa101ed36 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SingleSignOnStates.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.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Various states of the SSO resource. */ +public final class SingleSignOnStates extends ExpandableStringEnum { + /** Static value Initial for SingleSignOnStates. */ + public static final SingleSignOnStates INITIAL = fromString("Initial"); + + /** Static value Enable for SingleSignOnStates. */ + public static final SingleSignOnStates ENABLE = fromString("Enable"); + + /** Static value Disable for SingleSignOnStates. */ + public static final SingleSignOnStates DISABLE = fromString("Disable"); + + /** Static value Existing for SingleSignOnStates. */ + public static final SingleSignOnStates EXISTING = fromString("Existing"); + + /** + * Creates a new instance of SingleSignOnStates value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SingleSignOnStates() { + } + + /** + * Creates or finds a SingleSignOnStates from its string representation. + * + * @param name a name to look for. + * @return the corresponding SingleSignOnStates. + */ + @JsonCreator + public static SingleSignOnStates fromString(String name) { + return fromString(name, SingleSignOnStates.class); + } + + /** + * Gets known SingleSignOnStates values. + * + * @return known SingleSignOnStates values. + */ + public static Collection values() { + return values(SingleSignOnStates.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SwitchBillingRequest.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SwitchBillingRequest.java new file mode 100644 index 0000000000000..ed3e611b96b1a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/SwitchBillingRequest.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Request of a switch billing Operation. */ +@Fluent +public final class SwitchBillingRequest { + /* + * Azure resource Id + */ + @JsonProperty(value = "azureResourceId") + private String azureResourceId; + + /* + * Organization id + */ + @JsonProperty(value = "organizationId") + private String organizationId; + + /* + * Plan details + */ + @JsonProperty(value = "planData") + private PlanData planData; + + /* + * User Email + */ + @JsonProperty(value = "userEmail", required = true) + private String userEmail; + + /** Creates an instance of SwitchBillingRequest class. */ + public SwitchBillingRequest() { + } + + /** + * Get the azureResourceId property: Azure resource Id. + * + * @return the azureResourceId value. + */ + public String azureResourceId() { + return this.azureResourceId; + } + + /** + * Set the azureResourceId property: Azure resource Id. + * + * @param azureResourceId the azureResourceId value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withAzureResourceId(String azureResourceId) { + this.azureResourceId = azureResourceId; + return this; + } + + /** + * Get the organizationId property: Organization id. + * + * @return the organizationId value. + */ + public String organizationId() { + return this.organizationId; + } + + /** + * Set the organizationId property: Organization id. + * + * @param organizationId the organizationId value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withOrganizationId(String organizationId) { + this.organizationId = organizationId; + return this; + } + + /** + * Get the planData property: Plan details. + * + * @return the planData value. + */ + public PlanData planData() { + return this.planData; + } + + /** + * Set the planData property: Plan details. + * + * @param planData the planData value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withPlanData(PlanData planData) { + this.planData = planData; + return this; + } + + /** + * Get the userEmail property: User Email. + * + * @return the userEmail value. + */ + public String userEmail() { + return this.userEmail; + } + + /** + * Set the userEmail property: User Email. + * + * @param userEmail the userEmail value to set. + * @return the SwitchBillingRequest object itself. + */ + public SwitchBillingRequest withUserEmail(String userEmail) { + this.userEmail = userEmail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (planData() != null) { + planData().validate(); + } + if (userEmail() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property userEmail in model SwitchBillingRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SwitchBillingRequest.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagAction.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagAction.java new file mode 100644 index 0000000000000..bc98f7da77a94 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagAction.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Valid actions for a filtering tag. Exclusion takes priority over inclusion. */ +public final class TagAction extends ExpandableStringEnum { + /** Static value Include for TagAction. */ + public static final TagAction INCLUDE = fromString("Include"); + + /** Static value Exclude for TagAction. */ + public static final TagAction EXCLUDE = fromString("Exclude"); + + /** + * Creates a new instance of TagAction value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TagAction() { + } + + /** + * Creates or finds a TagAction from its string representation. + * + * @param name a name to look for. + * @return the corresponding TagAction. + */ + @JsonCreator + public static TagAction fromString(String name) { + return fromString(name, TagAction.class); + } + + /** + * Gets known TagAction values. + * + * @return known TagAction values. + */ + public static Collection values() { + return values(TagAction.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRule.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRule.java new file mode 100644 index 0000000000000..9323754452f34 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRule.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; + +/** An immutable client-side representation of TagRule. */ +public interface TagRule { + /** + * 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 systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: Provisioning State of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner object. + * + * @return the inner object. + */ + TagRuleInner innerModel(); + + /** The entirety of the TagRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The TagRule definition stages. */ + interface DefinitionStages { + /** The first stage of the TagRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the TagRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, monitorName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @return the next definition stage. + */ + WithCreate withExistingMonitor(String resourceGroupName, String monitorName); + } + /** + * The stage of the TagRule 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.WithLogRules, DefinitionStages.WithMetricRules { + /** + * Executes the create request. + * + * @return the created resource. + */ + TagRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TagRule create(Context context); + } + /** The stage of the TagRule definition allowing to specify logRules. */ + interface WithLogRules { + /** + * Specifies the logRules property: Set of rules for sending logs for the Monitor resource.. + * + * @param logRules Set of rules for sending logs for the Monitor resource. + * @return the next definition stage. + */ + WithCreate withLogRules(LogRules logRules); + } + /** The stage of the TagRule definition allowing to specify metricRules. */ + interface WithMetricRules { + /** + * Specifies the metricRules property: Set of rules for sending metrics for the Monitor resource.. + * + * @param metricRules Set of rules for sending metrics for the Monitor resource. + * @return the next definition stage. + */ + WithCreate withMetricRules(MetricRulesInner metricRules); + } + } + /** + * Begins update for the TagRule resource. + * + * @return the stage of resource update. + */ + TagRule.Update update(); + + /** The template for TagRule update. */ + interface Update extends UpdateStages.WithLogRules, UpdateStages.WithMetricRules { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TagRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TagRule apply(Context context); + } + /** The TagRule update stages. */ + interface UpdateStages { + /** The stage of the TagRule update allowing to specify logRules. */ + interface WithLogRules { + /** + * Specifies the logRules property: Set of rules for sending logs for the Monitor resource.. + * + * @param logRules Set of rules for sending logs for the Monitor resource. + * @return the next definition stage. + */ + Update withLogRules(LogRules logRules); + } + /** The stage of the TagRule update allowing to specify metricRules. */ + interface WithMetricRules { + /** + * Specifies the metricRules property: Set of rules for sending metrics for the Monitor resource.. + * + * @param metricRules Set of rules for sending metrics for the Monitor resource. + * @return the next definition stage. + */ + Update withMetricRules(MetricRulesInner metricRules); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TagRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TagRule refresh(Context context); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleListResult.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleListResult.java new file mode 100644 index 0000000000000..38d3bd256b780 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleListResult.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response of a TagRule list operation. */ +@Fluent +public final class TagRuleListResult { + /* + * The TagRule items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of TagRuleListResult class. */ + public TagRuleListResult() { + } + + /** + * Get the value property: The TagRule items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The TagRule items on this page. + * + * @param value the value value to set. + * @return the TagRuleListResult object itself. + */ + public TagRuleListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the TagRuleListResult object itself. + */ + public TagRuleListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model TagRuleListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TagRuleListResult.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleUpdate.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleUpdate.java new file mode 100644 index 0000000000000..5c8e2deb4fdce --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleUpdate.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner; + +/** An immutable client-side representation of TagRuleUpdate. */ +public interface TagRuleUpdate { + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner object. + * + * @return the inner object. + */ + TagRuleUpdateInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleUpdateProperties.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleUpdateProperties.java new file mode 100644 index 0000000000000..831a26093d566 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRuleUpdateProperties.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdatePropertiesInner; + +/** An immutable client-side representation of TagRuleUpdateProperties. */ +public interface TagRuleUpdateProperties { + /** + * Gets the logRules property: Set of rules for sending logs for the Monitor resource. + * + * @return the logRules value. + */ + LogRules logRules(); + + /** + * Gets the metricRules property: Set of rules for sending metrics for the Monitor resource. + * + * @return the metricRules value. + */ + MetricRules metricRules(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdatePropertiesInner object. + * + * @return the inner object. + */ + TagRuleUpdatePropertiesInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRules.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRules.java new file mode 100644 index 0000000000000..e3fd28c3cc9b1 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/TagRules.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.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 TagRules. */ +public interface TagRules { + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName); + + /** + * List TagRule resources by NewRelicMonitorResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors 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 of a TagRule list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByNewRelicMonitorResource(String resourceGroupName, String monitorName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule. + */ + TagRule get(String resourceGroupName, String monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @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 monitorName, String ruleSetName); + + /** + * Delete a TagRule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param monitorName Name of the Monitors resource. + * @param ruleSetName Name of the TagRule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String monitorName, String ruleSetName, Context context); + + /** + * Get a TagRule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + TagRule getById(String id); + + /** + * Get a TagRule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a TagRule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a TagRule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a TagRule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TagRule resource. + * + * @param name resource name. + * @return the first stage of the new TagRule definition. + */ + TagRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UsageType.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UsageType.java new file mode 100644 index 0000000000000..48a73b727f4d3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UsageType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Different usage type like PAYG/COMMITTED. */ +public final class UsageType extends ExpandableStringEnum { + /** Static value PAYG for UsageType. */ + public static final UsageType PAYG = fromString("PAYG"); + + /** Static value COMMITTED for UsageType. */ + public static final UsageType COMMITTED = fromString("COMMITTED"); + + /** + * Creates a new instance of UsageType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UsageType() { + } + + /** + * Creates or finds a UsageType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UsageType. + */ + @JsonCreator + public static UsageType fromString(String name) { + return fromString(name, UsageType.class); + } + + /** + * Gets known UsageType values. + * + * @return known UsageType values. + */ + public static Collection values() { + return values(UsageType.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UserAssignedIdentity.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..fd62890f013f2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UserAssignedIdentity.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.newrelicobservability.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public final class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** Creates an instance of UserAssignedIdentity class. */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UserInfo.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UserInfo.java new file mode 100644 index 0000000000000..9bd6581205776 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/UserInfo.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User Info of NewRelic Monitor resource. */ +@Fluent +public final class UserInfo { + /* + * First name + */ + @JsonProperty(value = "firstName") + private String firstName; + + /* + * Last name + */ + @JsonProperty(value = "lastName") + private String lastName; + + /* + * User Email + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /* + * Contact phone number + */ + @JsonProperty(value = "phoneNumber") + private String phoneNumber; + + /* + * country if user + */ + @JsonProperty(value = "country") + private String country; + + /** Creates an instance of UserInfo class. */ + public UserInfo() { + } + + /** + * Get the firstName property: First name. + * + * @return the firstName value. + */ + public String firstName() { + return this.firstName; + } + + /** + * Set the firstName property: First name. + * + * @param firstName the firstName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withFirstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get the lastName property: Last name. + * + * @return the lastName value. + */ + public String lastName() { + return this.lastName; + } + + /** + * Set the lastName property: Last name. + * + * @param lastName the lastName value to set. + * @return the UserInfo object itself. + */ + public UserInfo withLastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get the emailAddress property: User Email. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: User Email. + * + * @param emailAddress the emailAddress value to set. + * @return the UserInfo object itself. + */ + public UserInfo withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the phoneNumber property: Contact phone number. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: Contact phone number. + * + * @param phoneNumber the phoneNumber value to set. + * @return the UserInfo object itself. + */ + public UserInfo withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the country property: country if user. + * + * @return the country value. + */ + public String country() { + return this.country; + } + + /** + * Set the country property: country if user. + * + * @param country the country value to set. + * @return the UserInfo object itself. + */ + public UserInfo withCountry(String country) { + this.country = country; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMExtensionPayload.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMExtensionPayload.java new file mode 100644 index 0000000000000..51494f6b65c02 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMExtensionPayload.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMExtensionPayloadInner; + +/** An immutable client-side representation of VMExtensionPayload. */ +public interface VMExtensionPayload { + /** + * Gets the ingestionKey property: Ingestion key of the account. + * + * @return the ingestionKey value. + */ + String ingestionKey(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.VMExtensionPayloadInner object. + * + * @return the inner object. + */ + VMExtensionPayloadInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMHostsListResponse.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMHostsListResponse.java new file mode 100644 index 0000000000000..2c88b3ed93db9 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMHostsListResponse.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Response of a list VM Host Operation. */ +@Fluent +public final class VMHostsListResponse { + /* + * The VMInfo items on this page + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The link to the next page of items + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of VMHostsListResponse class. */ + public VMHostsListResponse() { + } + + /** + * Get the value property: The VMInfo items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The VMInfo items on this page. + * + * @param value the value value to set. + * @return the VMHostsListResponse object itself. + */ + public VMHostsListResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the VMHostsListResponse object itself. + */ + public VMHostsListResponse withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model VMHostsListResponse")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VMHostsListResponse.class); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMInfo.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMInfo.java new file mode 100644 index 0000000000000..a0a41cd6838de --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/VMInfo.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.newrelicobservability.models; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; + +/** An immutable client-side representation of VMInfo. */ +public interface VMInfo { + /** + * Gets the vmId property: Azure VM resource ID. + * + * @return the vmId value. + */ + String vmId(); + + /** + * Gets the agentVersion property: Version of the NewRelic agent installed on the VM. + * + * @return the agentVersion value. + */ + String agentVersion(); + + /** + * Gets the agentStatus property: Status of the NewRelic agent installed on the VM. + * + * @return the agentStatus value. + */ + String agentStatus(); + + /** + * Gets the inner com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner object. + * + * @return the inner object. + */ + VMInfoInner innerModel(); +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/package-info.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/package-info.java new file mode 100644 index 0000000000000..bbb69d3e3ea9b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/models/package-info.java @@ -0,0 +1,6 @@ +// 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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelicobservability.models; diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/package-info.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/package-info.java new file mode 100644 index 0000000000000..b9e83c443771e --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/com/azure/resourcemanager/newrelicobservability/package-info.java @@ -0,0 +1,6 @@ +// 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 NewRelicObservability. null. */ +package com.azure.resourcemanager.newrelicobservability; diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/module-info.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/main/java/module-info.java new file mode 100644 index 0000000000000..6705bb4a65a92 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/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.newrelicobservability { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.newrelicobservability; + exports com.azure.resourcemanager.newrelicobservability.fluent; + exports com.azure.resourcemanager.newrelicobservability.fluent.models; + exports com.azure.resourcemanager.newrelicobservability.models; + + opens com.azure.resourcemanager.newrelicobservability.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.newrelicobservability.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListSamples.java new file mode 100644 index 0000000000000..516eb19d31b28 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Accounts List. */ +public final class AccountsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MinimumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void accountsListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Accounts_List_MaximumSet_Gen.json + */ + /** + * Sample code: Accounts_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void accountsListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.accounts().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsCreateOrUpdateSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..7bdd63ba12f7a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsCreateOrUpdateSamples.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.AccountInfo; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationInfo; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors CreateOrUpdate. */ +public final class MonitorsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .define("cdlymktqw") + .withRegion("k") + .withExistingResourceGroup("rgNewRelic") + .withTags(mapOf("key6976", "oaxfhf")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsDeleteSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsDeleteSamples.java new file mode 100644 index 0000000000000..14a23120df53b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsDeleteSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Monitors Delete. */ +public final class MonitorsDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsDeleteMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().delete("rgopenapi", null, "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsDeleteMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .delete( + "rgopenapi", + "ruxvg@xqkmdhrnoo.hlmbpm", + "ipxmlcbonyxtolzejcjshkmlron", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetByResourceGroupSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..1fd0ec7174ba8 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Monitors GetByResourceGroup. */ +public final class MonitorsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricRulesSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricRulesSamples.java new file mode 100644 index 0000000000000..542936e66350a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricRulesSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; + +/** Samples for Monitors GetMetricRules. */ +public final class MonitorsGetMetricRulesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricRulesMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricRules_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricRules_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricRulesMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricRulesWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricStatusSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricStatusSamples.java new file mode 100644 index 0000000000000..21a9cd119e3ad --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricStatusSamples.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.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import java.util.Arrays; + +/** Samples for Monitors GetMetricStatus. */ +public final class MonitorsGetMetricStatusSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricStatusMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_GetMetricStatus_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_GetMetricStatus_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsGetMetricStatusMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .getMetricStatusWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new MetricsStatusRequest() + .withAzureResourceIds(Arrays.asList("enfghpfw")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListAppServicesSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListAppServicesSamples.java new file mode 100644 index 0000000000000..3b3dde31184a4 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListAppServicesSamples.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.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListAppServices. */ +public final class MonitorsListAppServicesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListAppServicesMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest() + .withAzureResourceIds(Arrays.asList("pvzrksrmzowobuhxpwiotnpcvjbu")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListAppServices_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListAppServices_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListAppServicesMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listAppServices( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new AppServicesGetRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListByResourceGroupSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..cab99236d2ccd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Monitors ListByResourceGroup. */ +public final class MonitorsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListByResourceGroup_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListByResourceGroupMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().listByResourceGroup("rgNewRelic", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListHostsSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListHostsSamples.java new file mode 100644 index 0000000000000..2e9cb754e589d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListHostsSamples.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.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import java.util.Arrays; + +/** Samples for Monitors ListHosts. */ +public final class MonitorsListHostsSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListHostsMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListHosts_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListHosts_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListHostsMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listHosts( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + new HostsGetRequest() + .withVmIds(Arrays.asList("xzphvxvfmvjrnsgyns")) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMonitoredResourcesSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMonitoredResourcesSamples.java new file mode 100644 index 0000000000000..f55726953027c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMonitoredResourcesSamples.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.newrelicobservability.generated; + +/** Samples for Monitors ListMonitoredResources. */ +public final class MonitorsListMonitoredResourcesSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListMonitoredResourcesMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListMonitoredResources_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListMonitoredResources_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListMonitoredResourcesMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .listMonitoredResources("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListSamples.java new file mode 100644 index 0000000000000..ad07a7b7b3e4b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Monitors List. */ +public final class MonitorsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_ListBySubscription_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsListBySubscriptionMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.monitors().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsSwitchBillingSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsSwitchBillingSamples.java new file mode 100644 index 0000000000000..1b9b2bc23ed86 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsSwitchBillingSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.time.OffsetDateTime; + +/** Samples for Monitors SwitchBilling. */ +public final class MonitorsSwitchBillingSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsSwitchBillingMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest().withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_SwitchBilling_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_SwitchBilling_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsSwitchBillingMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .switchBillingWithResponse( + "rgNewRelic", + "fhcjxnxumkdlgpwanewtkdnyuz", + new SwitchBillingRequest() + .withAzureResourceId("enfghpfw") + .withOrganizationId("k") + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withUserEmail("ruxvg@xqkmdhrnoo.hlmbpm"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsUpdateSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsUpdateSamples.java new file mode 100644 index 0000000000000..5a330c682937c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsUpdateSamples.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.AccountInfo; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationInfo; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.SingleSignOnStates; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Monitors Update. */ +public final class MonitorsUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + NewRelicMonitorResource resource = + manager + .monitors() + .getByResourceGroupWithResponse("rgNewRelic", "cdlymktqw", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key164", "jqakdrrmmyzytqu")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("key8903", new UserAssignedIdentity()))) + .withNewRelicAccountProperties( + new NewRelicAccountProperties() + .withUserId("vcscxlncofcuduadesd") + .withAccountInfo( + new AccountInfo() + .withAccountId("xhqmg") + .withIngestionKey("fakeTokenPlaceholder") + .withRegion("ljcf")) + .withOrganizationInfo(new OrganizationInfo().withOrganizationId("k")) + .withSingleSignOnProperties( + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("kwiwfz") + .withSingleSignOnUrl("kvseueuljsxmfwpqctz") + .withProvisioningState(ProvisioningState.ACCEPTED))) + .withUserInfo( + new UserInfo() + .withFirstName("vdftzcggirefejajwahhwhyibutramdaotvnuf") + .withLastName("bcsztgqovdlmzfkjdrngidwzqsevagexzzilnlc") + .withEmailAddress("%6%@4-g.N1.3F-kI1.Ue-.lJso") + .withPhoneNumber("krf") + .withCountry("hslqnwdanrconqyekwbnttaetv")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("tbbiaga") + .withEffectiveDate(OffsetDateTime.parse("2022-12-05T14:11:37.786Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsVmHostPayloadSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsVmHostPayloadSamples.java new file mode 100644 index 0000000000000..d98e2a0a91b2f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsVmHostPayloadSamples.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.newrelicobservability.generated; + +/** Samples for Monitors VmHostPayload. */ +public final class MonitorsVmHostPayloadSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MinimumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsVmHostPayloadMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Monitors_VmHostPayload_MaximumSet_Gen.json + */ + /** + * Sample code: Monitors_VmHostPayload_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void monitorsVmHostPayloadMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .monitors() + .vmHostPayloadWithResponse("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/OperationsListSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..56d831fb85969 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/OperationsListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void operationsListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void operationsListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListSamples.java new file mode 100644 index 0000000000000..cda13f6729a04 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Organizations List. */ +public final class OrganizationsListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void organizationsListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Organizations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Organizations_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void organizationsListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.organizations().list("ruxvg@xqkmdhrnoo.hlmbpm", "egh", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/PlansListSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/PlansListSamples.java new file mode 100644 index 0000000000000..5eb4e5e148033 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/PlansListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for Plans List. */ +public final class PlansListSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MaximumSet_Gen.json + */ + /** + * Sample code: Plans_List_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void plansListMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.plans().list("pwuxgvrmkk", "hilawwjz", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/Plans_List_MinimumSet_Gen.json + */ + /** + * Sample code: Plans_List_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void plansListMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager.plans().list(null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesCreateOrUpdateSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c90c7ff28236c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesCreateOrUpdateSamples.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.util.Arrays; + +/** Samples for TagRules CreateOrUpdate. */ +public final class TagRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesCreateOrUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .create(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_CreateOrUpdate_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_CreateOrUpdate_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesCreateOrUpdateMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .define("bxcantgzggsepbhqmedjqyrqeezmfb") + .withExistingMonitor("rgopenapi", "ipxmlcbonyxtolzejcjshkmlron") + .create(); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesDeleteSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesDeleteSamples.java new file mode 100644 index 0000000000000..224eaf1b0243e --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesDeleteSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for TagRules Delete. */ +public final class TagRulesDeleteSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesDeleteMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Delete_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesDeleteMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .delete( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesGetSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesGetSamples.java new file mode 100644 index 0000000000000..67deb0246151a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesGetSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for TagRules Get. */ +public final class TagRulesGetSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesGetMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Get_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Get_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesGetMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesListByNewRelicMonitorResourceSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesListByNewRelicMonitorResourceSamples.java new file mode 100644 index 0000000000000..a21cea33e641d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesListByNewRelicMonitorResourceSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +/** Samples for TagRules ListByNewRelicMonitorResource. */ +public final class TagRulesListByNewRelicMonitorResourceSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_ListByNewRelicMonitorResource_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesListByNewRelicMonitorResourceMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + manager + .tagRules() + .listByNewRelicMonitorResource( + "rgopenapi", "ipxmlcbonyxtolzejcjshkmlron", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesUpdateSamples.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesUpdateSamples.java new file mode 100644 index 0000000000000..bc12b201c1730 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/samples/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesUpdateSamples.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; +import java.util.Arrays; + +/** Samples for TagRules Update. */ +public final class TagRulesUpdateSamples { + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MaximumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MaximumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesUpdateMaximumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("saokgpjvdlorciqbjmjxazpee") + .withValue("sarxrqsxouhdjwsrqqicbeirdb") + .withAction(TagAction.INCLUDE))) + .withUserEmail("test@testing.com")) + .apply(); + } + + /* + * x-ms-original-file: specification/newrelic/resource-manager/NewRelic.Observability/preview/2022-07-01-preview/examples/TagRules_Update_MinimumSet_Gen.json + */ + /** + * Sample code: TagRules_Update_MinimumSet_Gen. + * + * @param manager Entry point to NewRelicObservabilityManager. + */ + public static void tagRulesUpdateMinimumSetGen( + com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager manager) { + TagRule resource = + manager + .tagRules() + .getWithResponse( + "rgopenapi", + "ipxmlcbonyxtolzejcjshkmlron", + "bxcantgzggsepbhqmedjqyrqeezmfb", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountPropertiesTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountPropertiesTests.java new file mode 100644 index 0000000000000..72eef6f3fb19c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountPropertiesTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountProperties; +import org.junit.jupiter.api.Assertions; + +public final class AccountPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountProperties model = + BinaryData + .fromString( + "{\"organizationId\":\"wixjsprozvcp\",\"accountId\":\"eg\",\"accountName\":\"wmfdatscmdvpjhul\",\"region\":\"uvm\"}") + .toObject(AccountProperties.class); + Assertions.assertEquals("wixjsprozvcp", model.organizationId()); + Assertions.assertEquals("eg", model.accountId()); + Assertions.assertEquals("wmfdatscmdvpjhul", model.accountName()); + Assertions.assertEquals("uvm", model.region()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountProperties model = + new AccountProperties() + .withOrganizationId("wixjsprozvcp") + .withAccountId("eg") + .withAccountName("wmfdatscmdvpjhul") + .withRegion("uvm"); + model = BinaryData.fromObject(model).toObject(AccountProperties.class); + Assertions.assertEquals("wixjsprozvcp", model.organizationId()); + Assertions.assertEquals("eg", model.accountId()); + Assertions.assertEquals("wmfdatscmdvpjhul", model.accountName()); + Assertions.assertEquals("uvm", model.region()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountResourceInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountResourceInnerTests.java new file mode 100644 index 0000000000000..d48031a8f8193 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountResourceInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class AccountResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"organizationId\":\"s\",\"accountId\":\"nyejhkryhtnap\",\"accountName\":\"wlokjyem\",\"region\":\"vnipjox\"},\"id\":\"nchgej\",\"name\":\"podmailzydehojwy\",\"type\":\"huxinpmqnj\"}") + .toObject(AccountResourceInner.class); + Assertions.assertEquals("s", model.organizationId()); + Assertions.assertEquals("nyejhkryhtnap", model.accountId()); + Assertions.assertEquals("wlokjyem", model.accountName()); + Assertions.assertEquals("vnipjox", model.region()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountResourceInner model = + new AccountResourceInner() + .withOrganizationId("s") + .withAccountId("nyejhkryhtnap") + .withAccountName("wlokjyem") + .withRegion("vnipjox"); + model = BinaryData.fromObject(model).toObject(AccountResourceInner.class); + Assertions.assertEquals("s", model.organizationId()); + Assertions.assertEquals("nyejhkryhtnap", model.accountId()); + Assertions.assertEquals("wlokjyem", model.accountName()); + Assertions.assertEquals("vnipjox", model.region()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListMockTests.java new file mode 100644 index 0000000000000..8e0eb3771d644 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListMockTests.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.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AccountResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class AccountsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"organizationId\":\"fclhaaxdbabphlwr\",\"accountId\":\"fkts\",\"accountName\":\"sucocmnyyazttbtw\",\"region\":\"qpuedckzywbiex\"},\"id\":\"eyueaxibxujwb\",\"name\":\"qwalmuzyoxaepd\",\"type\":\"zjancuxr\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.accounts().list("tkcxywnytnrsy", "lqidyby", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fclhaaxdbabphlwr", response.iterator().next().organizationId()); + Assertions.assertEquals("fkts", response.iterator().next().accountId()); + Assertions.assertEquals("sucocmnyyazttbtw", response.iterator().next().accountName()); + Assertions.assertEquals("qpuedckzywbiex", response.iterator().next().region()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListResponseTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListResponseTests.java new file mode 100644 index 0000000000000..d1749734275b7 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AccountsListResponseTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountsListResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AccountsListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AccountsListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"organizationId\":\"ithxqhabifpi\",\"accountId\":\"wczbys\",\"accountName\":\"pqxu\",\"region\":\"vyq\"},\"id\":\"wby\",\"name\":\"rkxvdum\",\"type\":\"grtfwvu\"}],\"nextLink\":\"gaudcc\"}") + .toObject(AccountsListResponse.class); + Assertions.assertEquals("ithxqhabifpi", model.value().get(0).organizationId()); + Assertions.assertEquals("wczbys", model.value().get(0).accountId()); + Assertions.assertEquals("pqxu", model.value().get(0).accountName()); + Assertions.assertEquals("vyq", model.value().get(0).region()); + Assertions.assertEquals("gaudcc", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AccountsListResponse model = + new AccountsListResponse() + .withValue( + Arrays + .asList( + new AccountResourceInner() + .withOrganizationId("ithxqhabifpi") + .withAccountId("wczbys") + .withAccountName("pqxu") + .withRegion("vyq"))) + .withNextLink("gaudcc"); + model = BinaryData.fromObject(model).toObject(AccountsListResponse.class); + Assertions.assertEquals("ithxqhabifpi", model.value().get(0).organizationId()); + Assertions.assertEquals("wczbys", model.value().get(0).accountId()); + Assertions.assertEquals("pqxu", model.value().get(0).accountName()); + Assertions.assertEquals("vyq", model.value().get(0).region()); + Assertions.assertEquals("gaudcc", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServiceInfoInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServiceInfoInnerTests.java new file mode 100644 index 0000000000000..8b390223fdc4f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServiceInfoInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import org.junit.jupiter.api.Assertions; + +public final class AppServiceInfoInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AppServiceInfoInner model = + BinaryData + .fromString( + "{\"azureResourceId\":\"azjdyggd\",\"agentVersion\":\"ixhbkuofqweykhm\",\"agentStatus\":\"evfyexfwhybcib\"}") + .toObject(AppServiceInfoInner.class); + Assertions.assertEquals("azjdyggd", model.azureResourceId()); + Assertions.assertEquals("ixhbkuofqweykhm", model.agentVersion()); + Assertions.assertEquals("evfyexfwhybcib", model.agentStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AppServiceInfoInner model = + new AppServiceInfoInner() + .withAzureResourceId("azjdyggd") + .withAgentVersion("ixhbkuofqweykhm") + .withAgentStatus("evfyexfwhybcib"); + model = BinaryData.fromObject(model).toObject(AppServiceInfoInner.class); + Assertions.assertEquals("azjdyggd", model.azureResourceId()); + Assertions.assertEquals("ixhbkuofqweykhm", model.agentVersion()); + Assertions.assertEquals("evfyexfwhybcib", model.agentStatus()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServicesGetRequestTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServicesGetRequestTests.java new file mode 100644 index 0000000000000..01035bd93e677 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServicesGetRequestTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AppServicesGetRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AppServicesGetRequest model = + BinaryData + .fromString("{\"azureResourceIds\":[\"dudgwdslfhot\"],\"userEmail\":\"mcy\"}") + .toObject(AppServicesGetRequest.class); + Assertions.assertEquals("dudgwdslfhot", model.azureResourceIds().get(0)); + Assertions.assertEquals("mcy", model.userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AppServicesGetRequest model = + new AppServicesGetRequest().withAzureResourceIds(Arrays.asList("dudgwdslfhot")).withUserEmail("mcy"); + model = BinaryData.fromObject(model).toObject(AppServicesGetRequest.class); + Assertions.assertEquals("dudgwdslfhot", model.azureResourceIds().get(0)); + Assertions.assertEquals("mcy", model.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServicesListResponseTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServicesListResponseTests.java new file mode 100644 index 0000000000000..82be020a7c68a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/AppServicesListResponseTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.AppServiceInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesListResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class AppServicesListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AppServicesListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"azureResourceId\":\"lbjnpgacftadehx\",\"agentVersion\":\"tyfsoppusuesn\",\"agentStatus\":\"dejbavo\"},{\"azureResourceId\":\"zdmohctbqvu\",\"agentVersion\":\"xdn\",\"agentStatus\":\"vo\"}],\"nextLink\":\"ujjugwdkcglh\"}") + .toObject(AppServicesListResponse.class); + Assertions.assertEquals("lbjnpgacftadehx", model.value().get(0).azureResourceId()); + Assertions.assertEquals("tyfsoppusuesn", model.value().get(0).agentVersion()); + Assertions.assertEquals("dejbavo", model.value().get(0).agentStatus()); + Assertions.assertEquals("ujjugwdkcglh", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AppServicesListResponse model = + new AppServicesListResponse() + .withValue( + Arrays + .asList( + new AppServiceInfoInner() + .withAzureResourceId("lbjnpgacftadehx") + .withAgentVersion("tyfsoppusuesn") + .withAgentStatus("dejbavo"), + new AppServiceInfoInner() + .withAzureResourceId("zdmohctbqvu") + .withAgentVersion("xdn") + .withAgentStatus("vo"))) + .withNextLink("ujjugwdkcglh"); + model = BinaryData.fromObject(model).toObject(AppServicesListResponse.class); + Assertions.assertEquals("lbjnpgacftadehx", model.value().get(0).azureResourceId()); + Assertions.assertEquals("tyfsoppusuesn", model.value().get(0).agentVersion()); + Assertions.assertEquals("dejbavo", model.value().get(0).agentStatus()); + Assertions.assertEquals("ujjugwdkcglh", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/FilteringTagTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/FilteringTagTests.java new file mode 100644 index 0000000000000..cdb298e9303bd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/FilteringTagTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import org.junit.jupiter.api.Assertions; + +public final class FilteringTagTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FilteringTag model = + BinaryData + .fromString("{\"name\":\"nqvpkvlrxnje\",\"value\":\"eipheoflokeyy\",\"action\":\"Include\"}") + .toObject(FilteringTag.class); + Assertions.assertEquals("nqvpkvlrxnje", model.name()); + Assertions.assertEquals("eipheoflokeyy", model.value()); + Assertions.assertEquals(TagAction.INCLUDE, model.action()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FilteringTag model = + new FilteringTag().withName("nqvpkvlrxnje").withValue("eipheoflokeyy").withAction(TagAction.INCLUDE); + model = BinaryData.fromObject(model).toObject(FilteringTag.class); + Assertions.assertEquals("nqvpkvlrxnje", model.name()); + Assertions.assertEquals("eipheoflokeyy", model.value()); + Assertions.assertEquals(TagAction.INCLUDE, model.action()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/HostsGetRequestTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/HostsGetRequestTests.java new file mode 100644 index 0000000000000..a16732f0db83b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/HostsGetRequestTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class HostsGetRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + HostsGetRequest model = + BinaryData + .fromString("{\"vmIds\":[\"xyqj\",\"k\",\"attpngjcrcczsq\",\"jh\"],\"userEmail\":\"mdajv\"}") + .toObject(HostsGetRequest.class); + Assertions.assertEquals("xyqj", model.vmIds().get(0)); + Assertions.assertEquals("mdajv", model.userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + HostsGetRequest model = + new HostsGetRequest().withVmIds(Arrays.asList("xyqj", "k", "attpngjcrcczsq", "jh")).withUserEmail("mdajv"); + model = BinaryData.fromObject(model).toObject(HostsGetRequest.class); + Assertions.assertEquals("xyqj", model.vmIds().get(0)); + Assertions.assertEquals("mdajv", model.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/LogRulesTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/LogRulesTests.java new file mode 100644 index 0000000000000..ea9ee3973b43b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/LogRulesTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LogRulesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogRules model = + BinaryData + .fromString( + "{\"sendAadLogs\":\"Enabled\",\"sendSubscriptionLogs\":\"Enabled\",\"sendActivityLogs\":\"Disabled\",\"filteringTags\":[{\"name\":\"gyxzk\",\"value\":\"ocukoklyax\",\"action\":\"Include\"},{\"name\":\"uqszfk\",\"value\":\"ypewrmjmwvvjekt\",\"action\":\"Include\"},{\"name\":\"nhwlrsffrzpwvl\",\"value\":\"q\",\"action\":\"Exclude\"},{\"name\":\"ylihkaetckt\",\"value\":\"civfsnkymuctq\",\"action\":\"Exclude\"}]}") + .toObject(LogRules.class); + Assertions.assertEquals(SendAadLogsStatus.ENABLED, model.sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.sendActivityLogs()); + Assertions.assertEquals("gyxzk", model.filteringTags().get(0).name()); + Assertions.assertEquals("ocukoklyax", model.filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.INCLUDE, model.filteringTags().get(0).action()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogRules model = + new LogRules() + .withSendAadLogs(SendAadLogsStatus.ENABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.DISABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag().withName("gyxzk").withValue("ocukoklyax").withAction(TagAction.INCLUDE), + new FilteringTag() + .withName("uqszfk") + .withValue("ypewrmjmwvvjekt") + .withAction(TagAction.INCLUDE), + new FilteringTag().withName("nhwlrsffrzpwvl").withValue("q").withAction(TagAction.EXCLUDE), + new FilteringTag() + .withName("ylihkaetckt") + .withValue("civfsnkymuctq") + .withAction(TagAction.EXCLUDE))); + model = BinaryData.fromObject(model).toObject(LogRules.class); + Assertions.assertEquals(SendAadLogsStatus.ENABLED, model.sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.sendActivityLogs()); + Assertions.assertEquals("gyxzk", model.filteringTags().get(0).name()); + Assertions.assertEquals("ocukoklyax", model.filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.INCLUDE, model.filteringTags().get(0).action()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/ManagedServiceIdentityTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/ManagedServiceIdentityTests.java new file mode 100644 index 0000000000000..c00dfb67cf00b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"22344daa-b3dd-4871-a36a-d87329d7986e\",\"tenantId\":\"16bf6317-f9b6-4a61-9cf6-7456b48948f6\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"t\":{\"principalId\":\"5fa19924-3de4-47a7-b9c4-9328b71f5f21\",\"clientId\":\"e177acc9-ba17-48b1-a55c-2b6bdc7b7d26\"},\"zzvypyqrimzinp\":{\"principalId\":\"2d1bab91-f616-4374-a992-3ba8e0b0a973\",\"clientId\":\"578e4597-1acb-4521-8b85-f56d5236689e\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model = + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf("t", new UserAssignedIdentity(), "zzvypyqrimzinp", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.type()); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricRulesInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricRulesInnerTests.java new file mode 100644 index 0000000000000..f55f60fa3e462 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricRulesInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetricRulesInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricRulesInner model = + BinaryData + .fromString( + "{\"sendMetrics\":\"Enabled\",\"filteringTags\":[{\"name\":\"m\",\"value\":\"qabcypm\",\"action\":\"Exclude\"},{\"name\":\"lzu\",\"value\":\"c\",\"action\":\"Exclude\"},{\"name\":\"nbacfi\",\"value\":\"l\",\"action\":\"Include\"},{\"name\":\"tqgtzxdpnqbqq\",\"value\":\"rjfeallnwsubisnj\",\"action\":\"Include\"}],\"userEmail\":\"ngnzscxaqwoochc\"}") + .toObject(MetricRulesInner.class); + Assertions.assertEquals(SendMetricsStatus.ENABLED, model.sendMetrics()); + Assertions.assertEquals("m", model.filteringTags().get(0).name()); + Assertions.assertEquals("qabcypm", model.filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.filteringTags().get(0).action()); + Assertions.assertEquals("ngnzscxaqwoochc", model.userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetricRulesInner model = + new MetricRulesInner() + .withSendMetrics(SendMetricsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag().withName("m").withValue("qabcypm").withAction(TagAction.EXCLUDE), + new FilteringTag().withName("lzu").withValue("c").withAction(TagAction.EXCLUDE), + new FilteringTag().withName("nbacfi").withValue("l").withAction(TagAction.INCLUDE), + new FilteringTag() + .withName("tqgtzxdpnqbqq") + .withValue("rjfeallnwsubisnj") + .withAction(TagAction.INCLUDE))) + .withUserEmail("ngnzscxaqwoochc"); + model = BinaryData.fromObject(model).toObject(MetricRulesInner.class); + Assertions.assertEquals(SendMetricsStatus.ENABLED, model.sendMetrics()); + Assertions.assertEquals("m", model.filteringTags().get(0).name()); + Assertions.assertEquals("qabcypm", model.filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.filteringTags().get(0).action()); + Assertions.assertEquals("ngnzscxaqwoochc", model.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsRequestTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsRequestTests.java new file mode 100644 index 0000000000000..f75bed659942b --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsRequestTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; +import org.junit.jupiter.api.Assertions; + +public final class MetricsRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricsRequest model = BinaryData.fromString("{\"userEmail\":\"ofsx\"}").toObject(MetricsRequest.class); + Assertions.assertEquals("ofsx", model.userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetricsRequest model = new MetricsRequest().withUserEmail("ofsx"); + model = BinaryData.fromObject(model).toObject(MetricsRequest.class); + Assertions.assertEquals("ofsx", model.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsStatusRequestTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsStatusRequestTests.java new file mode 100644 index 0000000000000..3de4e83529a50 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsStatusRequestTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetricsStatusRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricsStatusRequest model = + BinaryData + .fromString( + "{\"azureResourceIds\":[\"dlwtgrhpdj\",\"jumasx\",\"zj\",\"qyeg\"],\"userEmail\":\"alhbx\"}") + .toObject(MetricsStatusRequest.class); + Assertions.assertEquals("dlwtgrhpdj", model.azureResourceIds().get(0)); + Assertions.assertEquals("alhbx", model.userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetricsStatusRequest model = + new MetricsStatusRequest() + .withAzureResourceIds(Arrays.asList("dlwtgrhpdj", "jumasx", "zj", "qyeg")) + .withUserEmail("alhbx"); + model = BinaryData.fromObject(model).toObject(MetricsStatusRequest.class); + Assertions.assertEquals("dlwtgrhpdj", model.azureResourceIds().get(0)); + Assertions.assertEquals("alhbx", model.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsStatusResponseInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsStatusResponseInnerTests.java new file mode 100644 index 0000000000000..b1a22fb7525fb --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MetricsStatusResponseInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricsStatusResponseInner; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MetricsStatusResponseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricsStatusResponseInner model = + BinaryData.fromString("{\"azureResourceIds\":[\"jj\"]}").toObject(MetricsStatusResponseInner.class); + Assertions.assertEquals("jj", model.azureResourceIds().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetricsStatusResponseInner model = new MetricsStatusResponseInner().withAzureResourceIds(Arrays.asList("jj")); + model = BinaryData.fromObject(model).toObject(MetricsStatusResponseInner.class); + Assertions.assertEquals("jj", model.azureResourceIds().get(0)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoredResourceInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoredResourceInnerTests.java new file mode 100644 index 0000000000000..b73a117dc48a6 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoredResourceInnerTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendingMetricsStatus; +import org.junit.jupiter.api.Assertions; + +public final class MonitoredResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MonitoredResourceInner model = + BinaryData + .fromString( + "{\"id\":\"uqkhrsajiwku\",\"sendingMetrics\":\"Enabled\",\"reasonForMetricsStatus\":\"kg\",\"sendingLogs\":\"Enabled\",\"reasonForLogsStatus\":\"uimjmvx\"}") + .toObject(MonitoredResourceInner.class); + Assertions.assertEquals("uqkhrsajiwku", model.id()); + Assertions.assertEquals(SendingMetricsStatus.ENABLED, model.sendingMetrics()); + Assertions.assertEquals("kg", model.reasonForMetricsStatus()); + Assertions.assertEquals(SendingLogsStatus.ENABLED, model.sendingLogs()); + Assertions.assertEquals("uimjmvx", model.reasonForLogsStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MonitoredResourceInner model = + new MonitoredResourceInner() + .withId("uqkhrsajiwku") + .withSendingMetrics(SendingMetricsStatus.ENABLED) + .withReasonForMetricsStatus("kg") + .withSendingLogs(SendingLogsStatus.ENABLED) + .withReasonForLogsStatus("uimjmvx"); + model = BinaryData.fromObject(model).toObject(MonitoredResourceInner.class); + Assertions.assertEquals("uqkhrsajiwku", model.id()); + Assertions.assertEquals(SendingMetricsStatus.ENABLED, model.sendingMetrics()); + Assertions.assertEquals("kg", model.reasonForMetricsStatus()); + Assertions.assertEquals(SendingLogsStatus.ENABLED, model.sendingLogs()); + Assertions.assertEquals("uimjmvx", model.reasonForLogsStatus()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoredResourceListResponseTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoredResourceListResponseTests.java new file mode 100644 index 0000000000000..25d9a05d8acb6 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoredResourceListResponseTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoredResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.MonitoredResourceListResponse; +import com.azure.resourcemanager.newrelicobservability.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendingMetricsStatus; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MonitoredResourceListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MonitoredResourceListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"id\":\"gf\",\"sendingMetrics\":\"Disabled\",\"reasonForMetricsStatus\":\"ezyiuokktwhrdxw\",\"sendingLogs\":\"Enabled\",\"reasonForLogsStatus\":\"sm\"},{\"id\":\"ureximoryocfs\",\"sendingMetrics\":\"Enabled\",\"reasonForMetricsStatus\":\"mddystkiiux\",\"sendingLogs\":\"Disabled\",\"reasonForLogsStatus\":\"dxorrqnbpoczv\"},{\"id\":\"fqrvkdvjsllrmvvd\",\"sendingMetrics\":\"Enabled\",\"reasonForMetricsStatus\":\"kpnpulexxbczwtr\",\"sendingLogs\":\"Enabled\",\"reasonForLogsStatus\":\"zb\"},{\"id\":\"vsovmyokac\",\"sendingMetrics\":\"Enabled\",\"reasonForMetricsStatus\":\"lhzdobp\",\"sendingLogs\":\"Enabled\",\"reasonForLogsStatus\":\"lb\"}],\"nextLink\":\"nchrkcciww\"}") + .toObject(MonitoredResourceListResponse.class); + Assertions.assertEquals("gf", model.value().get(0).id()); + Assertions.assertEquals(SendingMetricsStatus.DISABLED, model.value().get(0).sendingMetrics()); + Assertions.assertEquals("ezyiuokktwhrdxw", model.value().get(0).reasonForMetricsStatus()); + Assertions.assertEquals(SendingLogsStatus.ENABLED, model.value().get(0).sendingLogs()); + Assertions.assertEquals("sm", model.value().get(0).reasonForLogsStatus()); + Assertions.assertEquals("nchrkcciww", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MonitoredResourceListResponse model = + new MonitoredResourceListResponse() + .withValue( + Arrays + .asList( + new MonitoredResourceInner() + .withId("gf") + .withSendingMetrics(SendingMetricsStatus.DISABLED) + .withReasonForMetricsStatus("ezyiuokktwhrdxw") + .withSendingLogs(SendingLogsStatus.ENABLED) + .withReasonForLogsStatus("sm"), + new MonitoredResourceInner() + .withId("ureximoryocfs") + .withSendingMetrics(SendingMetricsStatus.ENABLED) + .withReasonForMetricsStatus("mddystkiiux") + .withSendingLogs(SendingLogsStatus.DISABLED) + .withReasonForLogsStatus("dxorrqnbpoczv"), + new MonitoredResourceInner() + .withId("fqrvkdvjsllrmvvd") + .withSendingMetrics(SendingMetricsStatus.ENABLED) + .withReasonForMetricsStatus("kpnpulexxbczwtr") + .withSendingLogs(SendingLogsStatus.ENABLED) + .withReasonForLogsStatus("zb"), + new MonitoredResourceInner() + .withId("vsovmyokac") + .withSendingMetrics(SendingMetricsStatus.ENABLED) + .withReasonForMetricsStatus("lhzdobp") + .withSendingLogs(SendingLogsStatus.ENABLED) + .withReasonForLogsStatus("lb"))) + .withNextLink("nchrkcciww"); + model = BinaryData.fromObject(model).toObject(MonitoredResourceListResponse.class); + Assertions.assertEquals("gf", model.value().get(0).id()); + Assertions.assertEquals(SendingMetricsStatus.DISABLED, model.value().get(0).sendingMetrics()); + Assertions.assertEquals("ezyiuokktwhrdxw", model.value().get(0).reasonForMetricsStatus()); + Assertions.assertEquals(SendingLogsStatus.ENABLED, model.value().get(0).sendingLogs()); + Assertions.assertEquals("sm", model.value().get(0).reasonForLogsStatus()); + Assertions.assertEquals("nchrkcciww", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoringTagRulesPropertiesInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoringTagRulesPropertiesInnerTests.java new file mode 100644 index 0000000000000..e40fbe92d6b62 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitoringTagRulesPropertiesInnerTests.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MonitoringTagRulesPropertiesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class MonitoringTagRulesPropertiesInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MonitoringTagRulesPropertiesInner model = + BinaryData + .fromString( + "{\"provisioningState\":\"Accepted\",\"logRules\":{\"sendAadLogs\":\"Disabled\",\"sendSubscriptionLogs\":\"Disabled\",\"sendActivityLogs\":\"Disabled\",\"filteringTags\":[{\"name\":\"o\",\"value\":\"ukgjnpiucgygevq\",\"action\":\"Exclude\"},{\"name\":\"pmr\",\"value\":\"izcdrqjsd\",\"action\":\"Exclude\"},{\"name\":\"fyhxde\",\"value\":\"jzicwifsjt\",\"action\":\"Exclude\"}]},\"metricRules\":{\"sendMetrics\":\"Enabled\",\"filteringTags\":[{\"name\":\"bkh\",\"value\":\"deyeamdphagalpbu\",\"action\":\"Exclude\"},{\"name\":\"pwhonowkg\",\"value\":\"wankixzbi\",\"action\":\"Exclude\"},{\"name\":\"uttmrywnuzoqft\",\"value\":\"qzrnkcqvyxlwhz\",\"action\":\"Exclude\"}],\"userEmail\":\"ohoqqnwvlryav\"}}") + .toObject(MonitoringTagRulesPropertiesInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.DISABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals("o", model.logRules().filteringTags().get(0).name()); + Assertions.assertEquals("ukgjnpiucgygevq", model.logRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.logRules().filteringTags().get(0).action()); + Assertions.assertEquals(SendMetricsStatus.ENABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("bkh", model.metricRules().filteringTags().get(0).name()); + Assertions.assertEquals("deyeamdphagalpbu", model.metricRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.metricRules().filteringTags().get(0).action()); + Assertions.assertEquals("ohoqqnwvlryav", model.metricRules().userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MonitoringTagRulesPropertiesInner model = + new MonitoringTagRulesPropertiesInner() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.DISABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.DISABLED) + .withSendActivityLogs(SendActivityLogsStatus.DISABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("o") + .withValue("ukgjnpiucgygevq") + .withAction(TagAction.EXCLUDE), + new FilteringTag() + .withName("pmr") + .withValue("izcdrqjsd") + .withAction(TagAction.EXCLUDE), + new FilteringTag() + .withName("fyhxde") + .withValue("jzicwifsjt") + .withAction(TagAction.EXCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withSendMetrics(SendMetricsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("bkh") + .withValue("deyeamdphagalpbu") + .withAction(TagAction.EXCLUDE), + new FilteringTag() + .withName("pwhonowkg") + .withValue("wankixzbi") + .withAction(TagAction.EXCLUDE), + new FilteringTag() + .withName("uttmrywnuzoqft") + .withValue("qzrnkcqvyxlwhz") + .withAction(TagAction.EXCLUDE))) + .withUserEmail("ohoqqnwvlryav")); + model = BinaryData.fromObject(model).toObject(MonitoringTagRulesPropertiesInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.DISABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals("o", model.logRules().filteringTags().get(0).name()); + Assertions.assertEquals("ukgjnpiucgygevq", model.logRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.logRules().filteringTags().get(0).action()); + Assertions.assertEquals(SendMetricsStatus.ENABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("bkh", model.metricRules().filteringTags().get(0).name()); + Assertions.assertEquals("deyeamdphagalpbu", model.metricRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.metricRules().filteringTags().get(0).action()); + Assertions.assertEquals("ohoqqnwvlryav", model.metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsCreateOrUpdateMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..e4ccac9f1c679 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsCreateOrUpdateMockTests.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"monitoringStatus\":\"Enabled\",\"marketplaceSubscriptionStatus\":\"Suspended\",\"marketplaceSubscriptionId\":\"pswiydmcwyh\",\"newRelicAccountProperties\":{\"userId\":\"ss\"},\"userInfo\":{\"firstName\":\"vdfznudaodvxzb\",\"lastName\":\"blylpstdbh\",\"emailAddress\":\"srzdzucerscdn\",\"phoneNumber\":\"evfiwjmygt\",\"country\":\"slswtm\"},\"planData\":{\"usageType\":\"PAYG\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"pyqs\",\"effectiveDate\":\"2021-06-06T05:20:48Z\"},\"liftrResourceCategory\":\"Unknown\",\"liftrResourcePreference\":792180038,\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"a33037ed-f83c-469d-bb38-f80fc867d6a7\",\"tenantId\":\"6a6cba0a-fdd0-492c-9a74-1d473e6092eb\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{}},\"location\":\"vwiwubmwmbesld\",\"tags\":{\"z\":\"wtppjflcxogaoko\",\"fzxmhhvhgureodkw\":\"nsikvmkqzeqqkdl\"},\"id\":\"bdagxt\",\"name\":\"bqdxbx\",\"type\":\"akbogqxndlkzgxh\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + NewRelicMonitorResource response = + manager + .monitors() + .define("qtdo") + .withRegion("taruoujmkcj") + .withExistingResourceGroup("ivetvtcq") + .withTags( + mapOf("ervnaenqpehi", "ytjrybnwjewgdr", "mifthnzdnd", "doy", "nayqi", "l", "hqlkthumaqo", "ynduha")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withNewRelicAccountProperties(new NewRelicAccountProperties().withUserId("obl")) + .withUserInfo( + new UserInfo() + .withFirstName("pe") + .withLastName("wfbkrvrns") + .withEmailAddress("hqjohxcrsbfova") + .withPhoneNumber("ruvw") + .withCountry("sqfsubcgjbirxb")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.COMMITTED) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("jfdtwssotftpvj") + .withEffectiveDate(OffsetDateTime.parse("2021-04-19T06:05:29Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.LIFTR) + .create(); + + Assertions.assertEquals("vwiwubmwmbesld", response.location()); + Assertions.assertEquals("wtppjflcxogaoko", response.tags().get("z")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.identity().type()); + Assertions.assertEquals("ss", response.newRelicAccountProperties().userId()); + Assertions.assertEquals("vdfznudaodvxzb", response.userInfo().firstName()); + Assertions.assertEquals("blylpstdbh", response.userInfo().lastName()); + Assertions.assertEquals("srzdzucerscdn", response.userInfo().emailAddress()); + Assertions.assertEquals("evfiwjmygt", response.userInfo().phoneNumber()); + Assertions.assertEquals("slswtm", response.userInfo().country()); + Assertions.assertEquals(UsageType.PAYG, response.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, response.planData().billingCycle()); + Assertions.assertEquals("pyqs", response.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-06T05:20:48Z"), response.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, response.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, response.accountCreationSource()); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsDeleteMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsDeleteMockTests.java new file mode 100644 index 0000000000000..58544416f15e3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.monitors().delete("l", "zbtd", "xujznbmpowu", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetByResourceGroupWithResponseMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..4c4b03835f22a --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"Creating\",\"monitoringStatus\":\"Disabled\",\"marketplaceSubscriptionStatus\":\"Active\",\"marketplaceSubscriptionId\":\"melmqkrha\",\"newRelicAccountProperties\":{\"userId\":\"juahaquhcdhmdual\"},\"userInfo\":{\"firstName\":\"fadmws\",\"lastName\":\"r\",\"emailAddress\":\"xpvgo\",\"phoneNumber\":\"lf\",\"country\":\"sgwbnbbeld\"},\"planData\":{\"usageType\":\"COMMITTED\",\"billingCycle\":\"WEEKLY\",\"planDetails\":\"io\",\"effectiveDate\":\"2021-05-06T22:54:03Z\"},\"liftrResourceCategory\":\"Unknown\",\"liftrResourcePreference\":391809232,\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"94f25019-17d7-4c3a-8bc1-8d1485fe3a2f\",\"tenantId\":\"8f4549ec-b990-4e80-9ce5-b8a9d4ee21e8\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{}},\"location\":\"owzxcu\",\"tags\":{\"ucww\":\"jooxdjebw\",\"bvmeuecivy\":\"vo\",\"ueiotwmcdyt\":\"zceuojgjrw\",\"it\":\"x\"},\"id\":\"nrjawgqwg\",\"name\":\"hniskxfbkpyc\",\"type\":\"klwndnhjdauwhv\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + NewRelicMonitorResource response = + manager + .monitors() + .getByResourceGroupWithResponse("ehhseyvjusrts", "hspkdeemao", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("owzxcu", response.location()); + Assertions.assertEquals("jooxdjebw", response.tags().get("ucww")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.identity().type()); + Assertions.assertEquals("juahaquhcdhmdual", response.newRelicAccountProperties().userId()); + Assertions.assertEquals("fadmws", response.userInfo().firstName()); + Assertions.assertEquals("r", response.userInfo().lastName()); + Assertions.assertEquals("xpvgo", response.userInfo().emailAddress()); + Assertions.assertEquals("lf", response.userInfo().phoneNumber()); + Assertions.assertEquals("sgwbnbbeld", response.userInfo().country()); + Assertions.assertEquals(UsageType.COMMITTED, response.planData().usageType()); + Assertions.assertEquals(BillingCycle.WEEKLY, response.planData().billingCycle()); + Assertions.assertEquals("io", response.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-06T22:54:03Z"), response.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, response.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, response.accountCreationSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricRulesWithResponseMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricRulesWithResponseMockTests.java new file mode 100644 index 0000000000000..9e0c776c5b3b8 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricRulesWithResponseMockTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.MetricRules; +import com.azure.resourcemanager.newrelicobservability.models.MetricsRequest; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsGetMetricRulesWithResponseMockTests { + @Test + public void testGetMetricRulesWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"sendMetrics\":\"Disabled\",\"filteringTags\":[{\"name\":\"bpbewtghfgb\",\"value\":\"gw\",\"action\":\"Exclude\"},{\"name\":\"v\",\"value\":\"jkbegibtnmxiebww\",\"action\":\"Include\"},{\"name\":\"yqcgwrtzjuzgwy\",\"value\":\"htxongmtsavjc\",\"action\":\"Exclude\"},{\"name\":\"qpsrknftguvri\",\"value\":\"prwmdyvxqt\",\"action\":\"Include\"}],\"userEmail\":\"ww\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MetricRules response = + manager + .monitors() + .getMetricRulesWithResponse( + "przqlveu", + "lupj", + new MetricsRequest().withUserEmail("khfxobbcswsrt"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(SendMetricsStatus.DISABLED, response.sendMetrics()); + Assertions.assertEquals("bpbewtghfgb", response.filteringTags().get(0).name()); + Assertions.assertEquals("gw", response.filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, response.filteringTags().get(0).action()); + Assertions.assertEquals("ww", response.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricStatusWithResponseMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricStatusWithResponseMockTests.java new file mode 100644 index 0000000000000..65526cf5d25b2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsGetMetricStatusWithResponseMockTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusRequest; +import com.azure.resourcemanager.newrelicobservability.models.MetricsStatusResponse; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsGetMetricStatusWithResponseMockTests { + @Test + public void testGetMetricStatusWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"azureResourceIds\":[\"vxdjzlmwlxkvugf\",\"zovawjvz\",\"nluthnnp\"]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + MetricsStatusResponse response = + manager + .monitors() + .getMetricStatusWithResponse( + "oyq", + "exrmcqibycnojvk", + new MetricsStatusRequest() + .withAzureResourceIds(Arrays.asList("fqsgzvahapjy")) + .withUserEmail("hpvgqz"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("vxdjzlmwlxkvugf", response.azureResourceIds().get(0)); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListAppServicesMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListAppServicesMockTests.java new file mode 100644 index 0000000000000..8fd56d8b4eee8 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListAppServicesMockTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AppServiceInfo; +import com.azure.resourcemanager.newrelicobservability.models.AppServicesGetRequest; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsListAppServicesMockTests { + @Test + public void testListAppServices() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"azureResourceId\":\"nsmvbxwyj\",\"agentVersion\":\"lh\",\"agentStatus\":\"aalnjixi\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .monitors() + .listAppServices( + "nxipeil", + "jzuaejxdultskzbb", + new AppServicesGetRequest() + .withAzureResourceIds(Arrays.asList("umveekgpwozuhkf", "bsjyofdx", "uusdttouwa")) + .withUserEmail("oekqvk"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nsmvbxwyj", response.iterator().next().azureResourceId()); + Assertions.assertEquals("lh", response.iterator().next().agentVersion()); + Assertions.assertEquals("aalnjixi", response.iterator().next().agentStatus()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListByResourceGroupMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..f41b077c0eaf8 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListByResourceGroupMockTests.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"monitoringStatus\":\"Disabled\",\"marketplaceSubscriptionStatus\":\"Suspended\",\"marketplaceSubscriptionId\":\"pqsxvnmicy\",\"newRelicAccountProperties\":{\"userId\":\"eoveilovnotyf\"},\"userInfo\":{\"firstName\":\"k\",\"lastName\":\"x\",\"emailAddress\":\"bttk\",\"phoneNumber\":\"ywpnvjt\",\"country\":\"nermcl\"},\"planData\":{\"usageType\":\"PAYG\",\"billingCycle\":\"YEARLY\",\"planDetails\":\"uscrpabgyepsb\",\"effectiveDate\":\"2021-01-26T13:24:27Z\"},\"liftrResourceCategory\":\"MonitorLogs\",\"liftrResourcePreference\":2075352957,\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"0e016be2-2bd8-410f-9d18-558e9202d2f7\",\"tenantId\":\"16d88632-ea98-4e49-896c-e28b45bcda55\",\"type\":\"None\",\"userAssignedIdentities\":{}},\"location\":\"wfqkquj\",\"tags\":{\"xtccmg\":\"uyonobglaoc\",\"wfudwpzntxhdzhl\":\"udxytlmoyrx\",\"hckfrlhrx\":\"qj\",\"ca\":\"bkyvp\"},\"id\":\"uzbpzkafku\",\"name\":\"b\",\"type\":\"rnwb\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.monitors().listByResourceGroup("cwscwsvlx", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wfqkquj", response.iterator().next().location()); + Assertions.assertEquals("uyonobglaoc", response.iterator().next().tags().get("xtccmg")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + Assertions.assertEquals("eoveilovnotyf", response.iterator().next().newRelicAccountProperties().userId()); + Assertions.assertEquals("k", response.iterator().next().userInfo().firstName()); + Assertions.assertEquals("x", response.iterator().next().userInfo().lastName()); + Assertions.assertEquals("bttk", response.iterator().next().userInfo().emailAddress()); + Assertions.assertEquals("ywpnvjt", response.iterator().next().userInfo().phoneNumber()); + Assertions.assertEquals("nermcl", response.iterator().next().userInfo().country()); + Assertions.assertEquals(UsageType.PAYG, response.iterator().next().planData().usageType()); + Assertions.assertEquals(BillingCycle.YEARLY, response.iterator().next().planData().billingCycle()); + Assertions.assertEquals("uscrpabgyepsb", response.iterator().next().planData().planDetails()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-01-26T13:24:27Z"), response.iterator().next().planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, response.iterator().next().orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, response.iterator().next().accountCreationSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListHostsMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListHostsMockTests.java new file mode 100644 index 0000000000000..1ccd536ad56b6 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListHostsMockTests.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.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.HostsGetRequest; +import com.azure.resourcemanager.newrelicobservability.models.VMInfo; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsListHostsMockTests { + @Test + public void testListHosts() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{\"value\":[{\"vmId\":\"hhuao\",\"agentVersion\":\"pcqeqx\",\"agentStatus\":\"z\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .monitors() + .listHosts( + "gylgqgitxmedjvcs", + "ynqwwncwzzhxgk", + new HostsGetRequest() + .withVmIds(Arrays.asList("gucnapkte", "ellwptfdy")) + .withUserEmail("pfqbuaceopzf"), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hhuao", response.iterator().next().vmId()); + Assertions.assertEquals("pcqeqx", response.iterator().next().agentVersion()); + Assertions.assertEquals("z", response.iterator().next().agentStatus()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMockTests.java new file mode 100644 index 0000000000000..01f66d7c6df38 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMockTests.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"monitoringStatus\":\"Disabled\",\"marketplaceSubscriptionStatus\":\"Active\",\"marketplaceSubscriptionId\":\"niwdjsw\",\"newRelicAccountProperties\":{\"userId\":\"dbpgnxytxhp\"},\"userInfo\":{\"firstName\":\"zabglcuhxwt\",\"lastName\":\"yqiklbbovplwzb\",\"emailAddress\":\"gy\",\"phoneNumber\":\"uosvmkfssxqukk\",\"country\":\"l\"},\"planData\":{\"usageType\":\"COMMITTED\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"jzkdeslpvlopwi\",\"effectiveDate\":\"2021-09-12T13:52:28Z\"},\"liftrResourceCategory\":\"Unknown\",\"liftrResourcePreference\":1973154307,\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"4e8ba1ef-23ef-477b-9f32-b2e658ef3a60\",\"tenantId\":\"ad135c6f-ebb7-45a1-8f3a-ce2d8ddfbb6e\",\"type\":\"None\",\"userAssignedIdentities\":{}},\"location\":\"umnyqu\",\"tags\":{\"hsmtxpsiebtfhvp\":\"eojnabc\"},\"id\":\"sapskr\",\"name\":\"qmhjjdhtld\",\"type\":\"kyzxuutk\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.monitors().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("umnyqu", response.iterator().next().location()); + Assertions.assertEquals("eojnabc", response.iterator().next().tags().get("hsmtxpsiebtfhvp")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + Assertions.assertEquals("dbpgnxytxhp", response.iterator().next().newRelicAccountProperties().userId()); + Assertions.assertEquals("zabglcuhxwt", response.iterator().next().userInfo().firstName()); + Assertions.assertEquals("yqiklbbovplwzb", response.iterator().next().userInfo().lastName()); + Assertions.assertEquals("gy", response.iterator().next().userInfo().emailAddress()); + Assertions.assertEquals("uosvmkfssxqukk", response.iterator().next().userInfo().phoneNumber()); + Assertions.assertEquals("l", response.iterator().next().userInfo().country()); + Assertions.assertEquals(UsageType.COMMITTED, response.iterator().next().planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, response.iterator().next().planData().billingCycle()); + Assertions.assertEquals("jzkdeslpvlopwi", response.iterator().next().planData().planDetails()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-09-12T13:52:28Z"), response.iterator().next().planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.LIFTR, response.iterator().next().orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, response.iterator().next().accountCreationSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMonitoredResourcesMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMonitoredResourcesMockTests.java new file mode 100644 index 0000000000000..ad12cf1ac8dd3 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsListMonitoredResourcesMockTests.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.MonitoredResource; +import com.azure.resourcemanager.newrelicobservability.models.SendingLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendingMetricsStatus; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsListMonitoredResourcesMockTests { + @Test + public void testListMonitoredResources() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"id\":\"grcfb\",\"sendingMetrics\":\"Disabled\",\"reasonForMetricsStatus\":\"fqjhhkxbpvjymj\",\"sendingLogs\":\"Disabled\",\"reasonForLogsStatus\":\"yngudivk\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.monitors().listMonitoredResources("ahzxctobgbk", "moizpos", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("grcfb", response.iterator().next().id()); + Assertions.assertEquals(SendingMetricsStatus.DISABLED, response.iterator().next().sendingMetrics()); + Assertions.assertEquals("fqjhhkxbpvjymj", response.iterator().next().reasonForMetricsStatus()); + Assertions.assertEquals(SendingLogsStatus.DISABLED, response.iterator().next().sendingLogs()); + Assertions.assertEquals("yngudivk", response.iterator().next().reasonForLogsStatus()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsSwitchBillingWithResponseMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsSwitchBillingWithResponseMockTests.java new file mode 100644 index 0000000000000..17feff54f7c1c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/MonitorsSwitchBillingWithResponseMockTests.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class MonitorsSwitchBillingWithResponseMockTests { + @Test + public void testSwitchBillingWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(204); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager + .monitors() + .switchBillingWithResponse( + "xyawj", + "yaqcslyjpkiidz", + new SwitchBillingRequest() + .withAzureResourceId("xznelixhnrztf") + .withOrganizationId("hb") + .withPlanData( + new PlanData() + .withUsageType(UsageType.COMMITTED) + .withBillingCycle(BillingCycle.MONTHLY) + .withPlanDetails("ulppggdtpnapnyir") + .withEffectiveDate(OffsetDateTime.parse("2021-02-09T03:01:47Z"))) + .withUserEmail("hpigv"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceInnerTests.java new file mode 100644 index 0000000000000..1654a42da2c09 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceInnerTests.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NewRelicMonitorResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NewRelicMonitorResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"provisioningState\":\"Accepted\",\"monitoringStatus\":\"Disabled\",\"marketplaceSubscriptionStatus\":\"Active\",\"marketplaceSubscriptionId\":\"ltmrldh\",\"newRelicAccountProperties\":{\"userId\":\"zzd\"},\"userInfo\":{\"firstName\":\"cdgea\",\"lastName\":\"gphuticndvka\",\"emailAddress\":\"wyiftyhxhur\",\"phoneNumber\":\"ftyxolniw\",\"country\":\"cukjf\"},\"planData\":{\"usageType\":\"PAYG\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"lryplwckbasyy\",\"effectiveDate\":\"2021-05-24T00:31:31Z\"},\"liftrResourceCategory\":\"MonitorLogs\",\"liftrResourcePreference\":1048772360,\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"LIFTR\"},\"identity\":{\"principalId\":\"96d7edcd-0c52-430f-b2fa-82859d2d3ef7\",\"tenantId\":\"b2670463-2fea-43c1-8eb4-5bbfdd7627f7\",\"type\":\"None\",\"userAssignedIdentities\":{\"nqgoulzndli\":{\"principalId\":\"465c095f-6de6-4b12-b166-ea36812a31df\",\"clientId\":\"e9483262-5c27-4b61-bbeb-696bb4bacdf7\"}}},\"location\":\"yqkgfg\",\"tags\":{\"qedqytbciqfoufl\":\"adgakeqsrxybz\",\"glougpbk\":\"mnkzsmod\",\"uqktap\":\"tmut\",\"kdosvqw\":\"pwgcuertu\"},\"id\":\"bmdg\",\"name\":\"bjf\",\"type\":\"dgmb\"}") + .toObject(NewRelicMonitorResourceInner.class); + Assertions.assertEquals("yqkgfg", model.location()); + Assertions.assertEquals("adgakeqsrxybz", model.tags().get("qedqytbciqfoufl")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("zzd", model.newRelicAccountProperties().userId()); + Assertions.assertEquals("cdgea", model.userInfo().firstName()); + Assertions.assertEquals("gphuticndvka", model.userInfo().lastName()); + Assertions.assertEquals("wyiftyhxhur", model.userInfo().emailAddress()); + Assertions.assertEquals("ftyxolniw", model.userInfo().phoneNumber()); + Assertions.assertEquals("cukjf", model.userInfo().country()); + Assertions.assertEquals(UsageType.PAYG, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.planData().billingCycle()); + Assertions.assertEquals("lryplwckbasyy", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-24T00:31:31Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.LIFTR, model.accountCreationSource()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NewRelicMonitorResourceInner model = + new NewRelicMonitorResourceInner() + .withLocation("yqkgfg") + .withTags( + mapOf( + "qedqytbciqfoufl", + "adgakeqsrxybz", + "glougpbk", + "mnkzsmod", + "uqktap", + "tmut", + "kdosvqw", + "pwgcuertu")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities(mapOf("nqgoulzndli", new UserAssignedIdentity()))) + .withNewRelicAccountProperties(new NewRelicAccountProperties().withUserId("zzd")) + .withUserInfo( + new UserInfo() + .withFirstName("cdgea") + .withLastName("gphuticndvka") + .withEmailAddress("wyiftyhxhur") + .withPhoneNumber("ftyxolniw") + .withCountry("cukjf")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.MONTHLY) + .withPlanDetails("lryplwckbasyy") + .withEffectiveDate(OffsetDateTime.parse("2021-05-24T00:31:31Z"))) + .withOrgCreationSource(OrgCreationSource.NEWRELIC) + .withAccountCreationSource(AccountCreationSource.LIFTR); + model = BinaryData.fromObject(model).toObject(NewRelicMonitorResourceInner.class); + Assertions.assertEquals("yqkgfg", model.location()); + Assertions.assertEquals("adgakeqsrxybz", model.tags().get("qedqytbciqfoufl")); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("zzd", model.newRelicAccountProperties().userId()); + Assertions.assertEquals("cdgea", model.userInfo().firstName()); + Assertions.assertEquals("gphuticndvka", model.userInfo().lastName()); + Assertions.assertEquals("wyiftyhxhur", model.userInfo().emailAddress()); + Assertions.assertEquals("ftyxolniw", model.userInfo().phoneNumber()); + Assertions.assertEquals("cukjf", model.userInfo().country()); + Assertions.assertEquals(UsageType.PAYG, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.planData().billingCycle()); + Assertions.assertEquals("lryplwckbasyy", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-24T00:31:31Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.LIFTR, model.accountCreationSource()); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceListResultTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceListResultTests.java new file mode 100644 index 0000000000000..2c0cc28290316 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceListResultTests.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.NewRelicMonitorResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceListResult; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NewRelicMonitorResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NewRelicMonitorResourceListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Creating\",\"monitoringStatus\":\"Enabled\",\"marketplaceSubscriptionStatus\":\"Active\",\"marketplaceSubscriptionId\":\"dio\",\"liftrResourceCategory\":\"Unknown\",\"liftrResourcePreference\":2028392349,\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"1b8fcac0-b482-4b73-8719-25248d69c81c\",\"tenantId\":\"917057b0-f8a6-4286-860e-5e0902e1b69d\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{}},\"location\":\"oacctaza\",\"tags\":{\"fdosyg\":\"lahbcryff\"},\"id\":\"xpaojakhmsbz\",\"name\":\"hcrzevd\",\"type\":\"hlxaolthqtr\"},{\"properties\":{\"provisioningState\":\"Accepted\",\"monitoringStatus\":\"Disabled\",\"marketplaceSubscriptionStatus\":\"Suspended\",\"marketplaceSubscriptionId\":\"s\",\"liftrResourceCategory\":\"Unknown\",\"liftrResourcePreference\":1595507269,\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"569d6c49-cbaf-4199-a099-bf5fcc9f90c9\",\"tenantId\":\"7135d2f3-4192-4d96-94b1-1b0c3e2fc42e\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{}},\"location\":\"lluwfzitonpeq\",\"tags\":{\"xypininmayhuybbk\":\"kjlxofpdvhpf\",\"vamih\":\"odepoogin\",\"vyevcciqi\":\"ognarxzxtheotus\",\"zrnf\":\"nhungbw\"},\"id\":\"gxg\",\"name\":\"spemvtzfk\",\"type\":\"fublj\"},{\"properties\":{\"provisioningState\":\"Deleting\",\"monitoringStatus\":\"Disabled\",\"marketplaceSubscriptionStatus\":\"Active\",\"marketplaceSubscriptionId\":\"aeqjhqjbasvms\",\"liftrResourceCategory\":\"MonitorLogs\",\"liftrResourcePreference\":951964300,\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"NEWRELIC\"},\"identity\":{\"principalId\":\"1b9e35c8-de99-4b89-a4c3-49a4e72d7d0b\",\"tenantId\":\"549cc254-c08c-4bd3-a22b-c0f95928d25a\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{}},\"location\":\"wrwclxxwrljd\",\"tags\":{\"dkwt\":\"kcqvkocrc\",\"ssainqpjwnzll\":\"hxbnjbiksqrg\",\"bvmgxsabkyqduuji\":\"fmppe\"},\"id\":\"c\",\"name\":\"czdzev\",\"type\":\"dhkrwpdappdsbdk\"}],\"nextLink\":\"rwjfe\"}") + .toObject(NewRelicMonitorResourceListResult.class); + Assertions.assertEquals("oacctaza", model.value().get(0).location()); + Assertions.assertEquals("lahbcryff", model.value().get(0).tags().get("fdosyg")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.value().get(0).orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.value().get(0).accountCreationSource()); + Assertions.assertEquals("rwjfe", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NewRelicMonitorResourceListResult model = + new NewRelicMonitorResourceListResult() + .withValue( + Arrays + .asList( + new NewRelicMonitorResourceInner() + .withLocation("oacctaza") + .withTags(mapOf("fdosyg", "lahbcryff")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withOrgCreationSource(OrgCreationSource.NEWRELIC) + .withAccountCreationSource(AccountCreationSource.NEWRELIC), + new NewRelicMonitorResourceInner() + .withLocation("lluwfzitonpeq") + .withTags( + mapOf( + "xypininmayhuybbk", + "kjlxofpdvhpf", + "vamih", + "odepoogin", + "vyevcciqi", + "ognarxzxtheotus", + "zrnf", + "nhungbw")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.NEWRELIC), + new NewRelicMonitorResourceInner() + .withLocation("wrwclxxwrljd") + .withTags( + mapOf( + "dkwt", + "kcqvkocrc", + "ssainqpjwnzll", + "hxbnjbiksqrg", + "bvmgxsabkyqduuji", + "fmppe")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf())) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.NEWRELIC))) + .withNextLink("rwjfe"); + model = BinaryData.fromObject(model).toObject(NewRelicMonitorResourceListResult.class); + Assertions.assertEquals("oacctaza", model.value().get(0).location()); + Assertions.assertEquals("lahbcryff", model.value().get(0).tags().get("fdosyg")); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.value().get(0).orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.value().get(0).accountCreationSource()); + Assertions.assertEquals("rwjfe", model.nextLink()); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceUpdateTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceUpdateTests.java new file mode 100644 index 0000000000000..adfc2be33a612 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicMonitorResourceUpdateTests.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentity; +import com.azure.resourcemanager.newrelicobservability.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicAccountProperties; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicMonitorResourceUpdate; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NewRelicMonitorResourceUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NewRelicMonitorResourceUpdate model = + BinaryData + .fromString( + "{\"identity\":{\"principalId\":\"1a229709-966b-4c7f-a10e-e1b83d14b25f\",\"tenantId\":\"e3759aca-c424-4e1f-9ba5-76ed425217ed\",\"type\":\"None\",\"userAssignedIdentities\":{\"ciwqvhk\":{\"principalId\":\"0bea0406-1e3e-48bf-b2c4-a019deba09e0\",\"clientId\":\"93097a20-e541-4d02-a86b-cafbdaf536bd\"},\"uigdtopbobjog\":{\"principalId\":\"3b5ccaab-5fc4-4abb-af0e-98daef31efee\",\"clientId\":\"22926b3c-4f92-4cc1-8428-887eb82abe1d\"}}},\"tags\":{\"a\":\"w\"},\"properties\":{\"newRelicAccountProperties\":{\"userId\":\"rzayv\"},\"userInfo\":{\"firstName\":\"f\",\"lastName\":\"otkftutqxlngx\",\"emailAddress\":\"fgugnxkrxdqmid\",\"phoneNumber\":\"hzrvqd\",\"country\":\"bhj\"},\"planData\":{\"usageType\":\"COMMITTED\",\"billingCycle\":\"YEARLY\",\"planDetails\":\"qfbow\",\"effectiveDate\":\"2021-05-19T19:15:18Z\"},\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"NEWRELIC\"}}") + .toObject(NewRelicMonitorResourceUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("w", model.tags().get("a")); + Assertions.assertEquals("rzayv", model.newRelicAccountProperties().userId()); + Assertions.assertEquals("f", model.userInfo().firstName()); + Assertions.assertEquals("otkftutqxlngx", model.userInfo().lastName()); + Assertions.assertEquals("fgugnxkrxdqmid", model.userInfo().emailAddress()); + Assertions.assertEquals("hzrvqd", model.userInfo().phoneNumber()); + Assertions.assertEquals("bhj", model.userInfo().country()); + Assertions.assertEquals(UsageType.COMMITTED, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.YEARLY, model.planData().billingCycle()); + Assertions.assertEquals("qfbow", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-19T19:15:18Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.LIFTR, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.accountCreationSource()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NewRelicMonitorResourceUpdate model = + new NewRelicMonitorResourceUpdate() + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.NONE) + .withUserAssignedIdentities( + mapOf("ciwqvhk", new UserAssignedIdentity(), "uigdtopbobjog", new UserAssignedIdentity()))) + .withTags(mapOf("a", "w")) + .withNewRelicAccountProperties(new NewRelicAccountProperties().withUserId("rzayv")) + .withUserInfo( + new UserInfo() + .withFirstName("f") + .withLastName("otkftutqxlngx") + .withEmailAddress("fgugnxkrxdqmid") + .withPhoneNumber("hzrvqd") + .withCountry("bhj")) + .withPlanData( + new PlanData() + .withUsageType(UsageType.COMMITTED) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("qfbow") + .withEffectiveDate(OffsetDateTime.parse("2021-05-19T19:15:18Z"))) + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.NEWRELIC); + model = BinaryData.fromObject(model).toObject(NewRelicMonitorResourceUpdate.class); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.identity().type()); + Assertions.assertEquals("w", model.tags().get("a")); + Assertions.assertEquals("rzayv", model.newRelicAccountProperties().userId()); + Assertions.assertEquals("f", model.userInfo().firstName()); + Assertions.assertEquals("otkftutqxlngx", model.userInfo().lastName()); + Assertions.assertEquals("fgugnxkrxdqmid", model.userInfo().emailAddress()); + Assertions.assertEquals("hzrvqd", model.userInfo().phoneNumber()); + Assertions.assertEquals("bhj", model.userInfo().country()); + Assertions.assertEquals(UsageType.COMMITTED, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.YEARLY, model.planData().billingCycle()); + Assertions.assertEquals("qfbow", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-05-19T19:15:18Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.LIFTR, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.accountCreationSource()); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicSingleSignOnPropertiesTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicSingleSignOnPropertiesTests.java new file mode 100644 index 0000000000000..3f64b074eae53 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/NewRelicSingleSignOnPropertiesTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.NewRelicSingleSignOnProperties; +import com.azure.resourcemanager.newrelicobservability.models.ProvisioningState; +import com.azure.resourcemanager.newrelicobservability.models.SingleSignOnStates; +import org.junit.jupiter.api.Assertions; + +public final class NewRelicSingleSignOnPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NewRelicSingleSignOnProperties model = + BinaryData + .fromString( + "{\"singleSignOnState\":\"Initial\",\"enterpriseAppId\":\"itnwuizgazxufi\",\"singleSignOnUrl\":\"ckyfih\",\"provisioningState\":\"NotSpecified\"}") + .toObject(NewRelicSingleSignOnProperties.class); + Assertions.assertEquals(SingleSignOnStates.INITIAL, model.singleSignOnState()); + Assertions.assertEquals("itnwuizgazxufi", model.enterpriseAppId()); + Assertions.assertEquals("ckyfih", model.singleSignOnUrl()); + Assertions.assertEquals(ProvisioningState.NOT_SPECIFIED, model.provisioningState()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NewRelicSingleSignOnProperties model = + new NewRelicSingleSignOnProperties() + .withSingleSignOnState(SingleSignOnStates.INITIAL) + .withEnterpriseAppId("itnwuizgazxufi") + .withSingleSignOnUrl("ckyfih") + .withProvisioningState(ProvisioningState.NOT_SPECIFIED); + model = BinaryData.fromObject(model).toObject(NewRelicSingleSignOnProperties.class); + Assertions.assertEquals(SingleSignOnStates.INITIAL, model.singleSignOnState()); + Assertions.assertEquals("itnwuizgazxufi", model.enterpriseAppId()); + Assertions.assertEquals("ckyfih", model.singleSignOnUrl()); + Assertions.assertEquals(ProvisioningState.NOT_SPECIFIED, model.provisioningState()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationDisplayTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..eb95705cc2d70 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationDisplayTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = + BinaryData + .fromString( + "{\"provider\":\"yrtih\",\"resource\":\"tijbpzvgnwzsymgl\",\"operation\":\"fcyzkohdbihanufh\",\"description\":\"bj\"}") + .toObject(OperationDisplay.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = new OperationDisplay(); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationInnerTests.java new file mode 100644 index 0000000000000..17f43b2e1daaf --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OperationInner; +import com.azure.resourcemanager.newrelicobservability.models.OperationDisplay; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = + BinaryData + .fromString( + "{\"name\":\"usarhmofc\",\"isDataAction\":false,\"display\":{\"provider\":\"urkdtmlx\",\"resource\":\"kuksjtxukcdm\",\"operation\":\"rcryuanzwuxzdxta\",\"description\":\"lhmwhfpmrqobm\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationInner model = new OperationInner().withDisplay(new OperationDisplay()); + model = BinaryData.fromObject(model).toObject(OperationInner.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationListResultTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationListResultTests.java new file mode 100644 index 0000000000000..2e507159686a0 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationListResultTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.OperationListResult; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = + BinaryData + .fromString( + "{\"value\":[{\"name\":\"quvgjxpybczme\",\"isDataAction\":true,\"display\":{\"provider\":\"pbsphrupidgs\",\"resource\":\"bejhphoycmsxa\",\"operation\":\"hdxbmtqio\",\"description\":\"zehtbmu\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"izhwlrxy\",\"isDataAction\":false,\"display\":{\"provider\":\"ijgkdm\",\"resource\":\"azlobcufpdznrbt\",\"operation\":\"qjnqglhqgnufoooj\",\"description\":\"ifsqesaagdfmg\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"},{\"name\":\"rifkwm\",\"isDataAction\":true,\"display\":{\"provider\":\"izntocipao\",\"resource\":\"jpsq\",\"operation\":\"mpoyfd\",\"description\":\"ogknygjofjdd\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}],\"nextLink\":\"upewnwreitjzy\"}") + .toObject(OperationListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResult model = new OperationListResult(); + model = BinaryData.fromObject(model).toObject(OperationListResult.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationsListMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationsListMockTests.java new file mode 100644 index 0000000000000..56422a5cd7319 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OperationsListMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.Operation; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"name\":\"uynhijg\",\"isDataAction\":false,\"display\":{\"provider\":\"siarbutrcvpn\",\"resource\":\"zmhjrunmp\",\"operation\":\"tdbhrbnla\",\"description\":\"xmyskp\"},\"origin\":\"user\",\"actionType\":\"Internal\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationInfoTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationInfoTests.java new file mode 100644 index 0000000000000..63d7fbe57c8a8 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationInfoTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationInfo; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationInfo model = BinaryData.fromString("{\"organizationId\":\"zw\"}").toObject(OrganizationInfo.class); + Assertions.assertEquals("zw", model.organizationId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationInfo model = new OrganizationInfo().withOrganizationId("zw"); + model = BinaryData.fromObject(model).toObject(OrganizationInfo.class); + Assertions.assertEquals("zw", model.organizationId()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationPropertiesTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationPropertiesTests.java new file mode 100644 index 0000000000000..fd2c0dc1577ea --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationPropertiesTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationProperties; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationProperties model = + BinaryData + .fromString( + "{\"organizationId\":\"jwzrl\",\"organizationName\":\"mcl\",\"billingSource\":\"NEWRELIC\"}") + .toObject(OrganizationProperties.class); + Assertions.assertEquals("jwzrl", model.organizationId()); + Assertions.assertEquals("mcl", model.organizationName()); + Assertions.assertEquals(BillingSource.NEWRELIC, model.billingSource()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationProperties model = + new OrganizationProperties() + .withOrganizationId("jwzrl") + .withOrganizationName("mcl") + .withBillingSource(BillingSource.NEWRELIC); + model = BinaryData.fromObject(model).toObject(OrganizationProperties.class); + Assertions.assertEquals("jwzrl", model.organizationId()); + Assertions.assertEquals("mcl", model.organizationName()); + Assertions.assertEquals(BillingSource.NEWRELIC, model.billingSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationResourceInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationResourceInnerTests.java new file mode 100644 index 0000000000000..d76476215ebdd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationResourceInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"organizationId\":\"okaj\",\"organizationName\":\"npime\",\"billingSource\":\"AZURE\"},\"id\":\"xgcp\",\"name\":\"dg\",\"type\":\"aajrm\"}") + .toObject(OrganizationResourceInner.class); + Assertions.assertEquals("okaj", model.organizationId()); + Assertions.assertEquals("npime", model.organizationName()); + Assertions.assertEquals(BillingSource.AZURE, model.billingSource()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationResourceInner model = + new OrganizationResourceInner() + .withOrganizationId("okaj") + .withOrganizationName("npime") + .withBillingSource(BillingSource.AZURE); + model = BinaryData.fromObject(model).toObject(OrganizationResourceInner.class); + Assertions.assertEquals("okaj", model.organizationId()); + Assertions.assertEquals("npime", model.organizationName()); + Assertions.assertEquals(BillingSource.AZURE, model.billingSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListMockTests.java new file mode 100644 index 0000000000000..bc3f06e7f7588 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListMockTests.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.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationResource; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class OrganizationsListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"organizationId\":\"mubyynt\",\"organizationName\":\"rbqtkoie\",\"billingSource\":\"AZURE\"},\"id\":\"tgqr\",\"name\":\"ltmuwlauwzizx\",\"type\":\"mpgcjefuzmuvpbt\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.organizations().list("ripl", "podxunkb", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mubyynt", response.iterator().next().organizationId()); + Assertions.assertEquals("rbqtkoie", response.iterator().next().organizationName()); + Assertions.assertEquals(BillingSource.AZURE, response.iterator().next().billingSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListResponseTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListResponseTests.java new file mode 100644 index 0000000000000..1da9f7158aa02 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/OrganizationsListResponseTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.OrganizationResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.BillingSource; +import com.azure.resourcemanager.newrelicobservability.models.OrganizationsListResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class OrganizationsListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OrganizationsListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"organizationId\":\"irsoodqxhcrmnohj\",\"organizationName\":\"kwh\",\"billingSource\":\"NEWRELIC\"},\"id\":\"fiyipjxsqwpgrj\",\"name\":\"znorcj\",\"type\":\"vsnb\"},{\"properties\":{\"organizationId\":\"abnmocpcyshu\",\"organizationName\":\"afbljjgpbtoqcjmk\",\"billingSource\":\"AZURE\"},\"id\":\"bqidtqaj\",\"name\":\"yulpkudjkr\",\"type\":\"khbzhfepgzg\"},{\"properties\":{\"organizationId\":\"zloc\",\"organizationName\":\"c\",\"billingSource\":\"NEWRELIC\"},\"id\":\"rhhbcs\",\"name\":\"l\",\"type\":\"mmajtjaodx\"}],\"nextLink\":\"nbdxk\"}") + .toObject(OrganizationsListResponse.class); + Assertions.assertEquals("irsoodqxhcrmnohj", model.value().get(0).organizationId()); + Assertions.assertEquals("kwh", model.value().get(0).organizationName()); + Assertions.assertEquals(BillingSource.NEWRELIC, model.value().get(0).billingSource()); + Assertions.assertEquals("nbdxk", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OrganizationsListResponse model = + new OrganizationsListResponse() + .withValue( + Arrays + .asList( + new OrganizationResourceInner() + .withOrganizationId("irsoodqxhcrmnohj") + .withOrganizationName("kwh") + .withBillingSource(BillingSource.NEWRELIC), + new OrganizationResourceInner() + .withOrganizationId("abnmocpcyshu") + .withOrganizationName("afbljjgpbtoqcjmk") + .withBillingSource(BillingSource.AZURE), + new OrganizationResourceInner() + .withOrganizationId("zloc") + .withOrganizationName("c") + .withBillingSource(BillingSource.NEWRELIC))) + .withNextLink("nbdxk"); + model = BinaryData.fromObject(model).toObject(OrganizationsListResponse.class); + Assertions.assertEquals("irsoodqxhcrmnohj", model.value().get(0).organizationId()); + Assertions.assertEquals("kwh", model.value().get(0).organizationName()); + Assertions.assertEquals(BillingSource.NEWRELIC, model.value().get(0).billingSource()); + Assertions.assertEquals("nbdxk", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataListResponseTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataListResponseTests.java new file mode 100644 index 0000000000000..3c146b86aa769 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataListResponseTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanDataListResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PlanDataListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlanDataListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"NEWRELIC\"},\"id\":\"zaqsqsycbkbfk\",\"name\":\"ukdkexxppofmxa\",\"type\":\"c\"}],\"nextLink\":\"pg\"}") + .toObject(PlanDataListResponse.class); + Assertions.assertEquals(OrgCreationSource.LIFTR, model.value().get(0).orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.value().get(0).accountCreationSource()); + Assertions.assertEquals("pg", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlanDataListResponse model = + new PlanDataListResponse() + .withValue( + Arrays + .asList( + new PlanDataResourceInner() + .withOrgCreationSource(OrgCreationSource.LIFTR) + .withAccountCreationSource(AccountCreationSource.NEWRELIC))) + .withNextLink("pg"); + model = BinaryData.fromObject(model).toObject(PlanDataListResponse.class); + Assertions.assertEquals(OrgCreationSource.LIFTR, model.value().get(0).orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.value().get(0).accountCreationSource()); + Assertions.assertEquals("pg", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataPropertiesTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataPropertiesTests.java new file mode 100644 index 0000000000000..d7d14f72dfc47 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataPropertiesTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataProperties; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class PlanDataPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlanDataProperties model = + BinaryData + .fromString( + "{\"planData\":{\"usageType\":\"PAYG\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"ddglm\",\"effectiveDate\":\"2020-12-21T16:15:31Z\"},\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"NEWRELIC\"}") + .toObject(PlanDataProperties.class); + Assertions.assertEquals(UsageType.PAYG, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.planData().billingCycle()); + Assertions.assertEquals("ddglm", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-21T16:15:31Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.accountCreationSource()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlanDataProperties model = + new PlanDataProperties() + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.MONTHLY) + .withPlanDetails("ddglm") + .withEffectiveDate(OffsetDateTime.parse("2020-12-21T16:15:31Z"))) + .withOrgCreationSource(OrgCreationSource.NEWRELIC) + .withAccountCreationSource(AccountCreationSource.NEWRELIC); + model = BinaryData.fromObject(model).toObject(PlanDataProperties.class); + Assertions.assertEquals(UsageType.PAYG, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.planData().billingCycle()); + Assertions.assertEquals("ddglm", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-21T16:15:31Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.NEWRELIC, model.accountCreationSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataResourceInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataResourceInnerTests.java new file mode 100644 index 0000000000000..d3fa0b9682300 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataResourceInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.PlanDataResourceInner; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class PlanDataResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlanDataResourceInner model = + BinaryData + .fromString( + "{\"properties\":{\"planData\":{\"usageType\":\"PAYG\",\"billingCycle\":\"YEARLY\",\"planDetails\":\"hvpmoue\",\"effectiveDate\":\"2021-06-30T20:07:19Z\"},\"orgCreationSource\":\"NEWRELIC\",\"accountCreationSource\":\"LIFTR\"},\"id\":\"eojnxqbzvddn\",\"name\":\"wndeicbtwnp\",\"type\":\"aoqvuh\"}") + .toObject(PlanDataResourceInner.class); + Assertions.assertEquals(UsageType.PAYG, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.YEARLY, model.planData().billingCycle()); + Assertions.assertEquals("hvpmoue", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-30T20:07:19Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.LIFTR, model.accountCreationSource()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlanDataResourceInner model = + new PlanDataResourceInner() + .withPlanData( + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.YEARLY) + .withPlanDetails("hvpmoue") + .withEffectiveDate(OffsetDateTime.parse("2021-06-30T20:07:19Z"))) + .withOrgCreationSource(OrgCreationSource.NEWRELIC) + .withAccountCreationSource(AccountCreationSource.LIFTR); + model = BinaryData.fromObject(model).toObject(PlanDataResourceInner.class); + Assertions.assertEquals(UsageType.PAYG, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.YEARLY, model.planData().billingCycle()); + Assertions.assertEquals("hvpmoue", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-30T20:07:19Z"), model.planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.NEWRELIC, model.orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.LIFTR, model.accountCreationSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataTests.java new file mode 100644 index 0000000000000..69a3e3041b2ec --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlanDataTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class PlanDataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PlanData model = + BinaryData + .fromString( + "{\"usageType\":\"PAYG\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"mdwzjeiachboo\",\"effectiveDate\":\"2021-07-31T08:54:57Z\"}") + .toObject(PlanData.class); + Assertions.assertEquals(UsageType.PAYG, model.usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.billingCycle()); + Assertions.assertEquals("mdwzjeiachboo", model.planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T08:54:57Z"), model.effectiveDate()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PlanData model = + new PlanData() + .withUsageType(UsageType.PAYG) + .withBillingCycle(BillingCycle.MONTHLY) + .withPlanDetails("mdwzjeiachboo") + .withEffectiveDate(OffsetDateTime.parse("2021-07-31T08:54:57Z")); + model = BinaryData.fromObject(model).toObject(PlanData.class); + Assertions.assertEquals(UsageType.PAYG, model.usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.billingCycle()); + Assertions.assertEquals("mdwzjeiachboo", model.planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-31T08:54:57Z"), model.effectiveDate()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlansListMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlansListMockTests.java new file mode 100644 index 0000000000000..188fbdb5683e5 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/PlansListMockTests.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.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.AccountCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.OrgCreationSource; +import com.azure.resourcemanager.newrelicobservability.models.PlanDataResource; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class PlansListMockTests { + @Test + public void testList() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"planData\":{\"usageType\":\"COMMITTED\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"hdneuelfph\",\"effectiveDate\":\"2021-11-10T22:29:39Z\"},\"orgCreationSource\":\"LIFTR\",\"accountCreationSource\":\"LIFTR\"},\"id\":\"ikdowwquuvx\",\"name\":\"xclvit\",\"type\":\"hqzonosggbhcoh\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager.plans().list("d", "morppxebmnzbtbh", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(UsageType.COMMITTED, response.iterator().next().planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, response.iterator().next().planData().billingCycle()); + Assertions.assertEquals("hdneuelfph", response.iterator().next().planData().planDetails()); + Assertions + .assertEquals( + OffsetDateTime.parse("2021-11-10T22:29:39Z"), response.iterator().next().planData().effectiveDate()); + Assertions.assertEquals(OrgCreationSource.LIFTR, response.iterator().next().orgCreationSource()); + Assertions.assertEquals(AccountCreationSource.LIFTR, response.iterator().next().accountCreationSource()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/SwitchBillingRequestTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/SwitchBillingRequestTests.java new file mode 100644 index 0000000000000..51bfece6cd933 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/SwitchBillingRequestTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.BillingCycle; +import com.azure.resourcemanager.newrelicobservability.models.PlanData; +import com.azure.resourcemanager.newrelicobservability.models.SwitchBillingRequest; +import com.azure.resourcemanager.newrelicobservability.models.UsageType; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class SwitchBillingRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SwitchBillingRequest model = + BinaryData + .fromString( + "{\"azureResourceId\":\"vdcsitynn\",\"organizationId\":\"mdectehfiqscjey\",\"planData\":{\"usageType\":\"COMMITTED\",\"billingCycle\":\"MONTHLY\",\"planDetails\":\"gqhcjrefovg\",\"effectiveDate\":\"2021-10-26T09:37:04Z\"},\"userEmail\":\"sle\"}") + .toObject(SwitchBillingRequest.class); + Assertions.assertEquals("vdcsitynn", model.azureResourceId()); + Assertions.assertEquals("mdectehfiqscjey", model.organizationId()); + Assertions.assertEquals(UsageType.COMMITTED, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.planData().billingCycle()); + Assertions.assertEquals("gqhcjrefovg", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-26T09:37:04Z"), model.planData().effectiveDate()); + Assertions.assertEquals("sle", model.userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SwitchBillingRequest model = + new SwitchBillingRequest() + .withAzureResourceId("vdcsitynn") + .withOrganizationId("mdectehfiqscjey") + .withPlanData( + new PlanData() + .withUsageType(UsageType.COMMITTED) + .withBillingCycle(BillingCycle.MONTHLY) + .withPlanDetails("gqhcjrefovg") + .withEffectiveDate(OffsetDateTime.parse("2021-10-26T09:37:04Z"))) + .withUserEmail("sle"); + model = BinaryData.fromObject(model).toObject(SwitchBillingRequest.class); + Assertions.assertEquals("vdcsitynn", model.azureResourceId()); + Assertions.assertEquals("mdectehfiqscjey", model.organizationId()); + Assertions.assertEquals(UsageType.COMMITTED, model.planData().usageType()); + Assertions.assertEquals(BillingCycle.MONTHLY, model.planData().billingCycle()); + Assertions.assertEquals("gqhcjrefovg", model.planData().planDetails()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-26T09:37:04Z"), model.planData().effectiveDate()); + Assertions.assertEquals("sle", model.userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleInnerTests.java new file mode 100644 index 0000000000000..f446c92709af6 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TagRuleInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TagRuleInner model = + BinaryData + .fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"logRules\":{\"sendAadLogs\":\"Disabled\",\"sendSubscriptionLogs\":\"Enabled\",\"sendActivityLogs\":\"Disabled\",\"filteringTags\":[]},\"metricRules\":{\"sendMetrics\":\"Enabled\",\"filteringTags\":[],\"userEmail\":\"burvjxxjnspy\"}},\"id\":\"tko\",\"name\":\"nkoukn\",\"type\":\"udwtiukbl\"}") + .toObject(TagRuleInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.ENABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("burvjxxjnspy", model.metricRules().userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TagRuleInner model = + new TagRuleInner() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.DISABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.DISABLED) + .withFilteringTags(Arrays.asList())) + .withMetricRules( + new MetricRulesInner() + .withSendMetrics(SendMetricsStatus.ENABLED) + .withFilteringTags(Arrays.asList()) + .withUserEmail("burvjxxjnspy")); + model = BinaryData.fromObject(model).toObject(TagRuleInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.ENABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("burvjxxjnspy", model.metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleListResultTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleListResultTests.java new file mode 100644 index 0000000000000..82b1370b03de2 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleListResultTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleInner; +import com.azure.resourcemanager.newrelicobservability.models.TagRuleListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TagRuleListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TagRuleListResult model = + BinaryData + .fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"id\":\"dyjrrfbyaosv\",\"name\":\"xc\",\"type\":\"onpc\"},{\"properties\":{\"provisioningState\":\"Accepted\"},\"id\":\"slkevle\",\"name\":\"gz\",\"type\":\"buhfmvfaxkffeiit\"}],\"nextLink\":\"vmezy\"}") + .toObject(TagRuleListResult.class); + Assertions.assertEquals("vmezy", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TagRuleListResult model = + new TagRuleListResult() + .withValue(Arrays.asList(new TagRuleInner(), new TagRuleInner())) + .withNextLink("vmezy"); + model = BinaryData.fromObject(model).toObject(TagRuleListResult.class); + Assertions.assertEquals("vmezy", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleUpdateInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleUpdateInnerTests.java new file mode 100644 index 0000000000000..9009dbb1fc46c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleUpdateInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdateInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TagRuleUpdateInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TagRuleUpdateInner model = + BinaryData + .fromString( + "{\"properties\":{\"logRules\":{\"sendAadLogs\":\"Disabled\",\"sendSubscriptionLogs\":\"Enabled\",\"sendActivityLogs\":\"Disabled\",\"filteringTags\":[]},\"metricRules\":{\"sendMetrics\":\"Disabled\",\"filteringTags\":[],\"userEmail\":\"xfvjrbirp\"}}}") + .toObject(TagRuleUpdateInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.DISABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("xfvjrbirp", model.metricRules().userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TagRuleUpdateInner model = + new TagRuleUpdateInner() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.DISABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.DISABLED) + .withFilteringTags(Arrays.asList())) + .withMetricRules( + new MetricRulesInner() + .withSendMetrics(SendMetricsStatus.DISABLED) + .withFilteringTags(Arrays.asList()) + .withUserEmail("xfvjrbirp")); + model = BinaryData.fromObject(model).toObject(TagRuleUpdateInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.DISABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("xfvjrbirp", model.metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleUpdatePropertiesInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleUpdatePropertiesInnerTests.java new file mode 100644 index 0000000000000..6b4858324a0bd --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRuleUpdatePropertiesInnerTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.fluent.models.TagRuleUpdatePropertiesInner; +import com.azure.resourcemanager.newrelicobservability.models.FilteringTag; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagAction; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class TagRuleUpdatePropertiesInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TagRuleUpdatePropertiesInner model = + BinaryData + .fromString( + "{\"logRules\":{\"sendAadLogs\":\"Disabled\",\"sendSubscriptionLogs\":\"Enabled\",\"sendActivityLogs\":\"Enabled\",\"filteringTags\":[{\"name\":\"ljkyqxjvuuj\",\"value\":\"idokgjlj\",\"action\":\"Include\"},{\"name\":\"vcltbgsncgh\",\"value\":\"esz\",\"action\":\"Exclude\"}]},\"metricRules\":{\"sendMetrics\":\"Disabled\",\"filteringTags\":[{\"name\":\"vgxbfs\",\"value\":\"nehmpvecx\",\"action\":\"Exclude\"},{\"name\":\"bfqkkr\",\"value\":\"pukgriwflzlfb\",\"action\":\"Include\"},{\"name\":\"zycispn\",\"value\":\"ahmgkbrp\",\"action\":\"Include\"}],\"userEmail\":\"ibnuqqkpik\"}}") + .toObject(TagRuleUpdatePropertiesInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.ENABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals("ljkyqxjvuuj", model.logRules().filteringTags().get(0).name()); + Assertions.assertEquals("idokgjlj", model.logRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.INCLUDE, model.logRules().filteringTags().get(0).action()); + Assertions.assertEquals(SendMetricsStatus.DISABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("vgxbfs", model.metricRules().filteringTags().get(0).name()); + Assertions.assertEquals("nehmpvecx", model.metricRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.metricRules().filteringTags().get(0).action()); + Assertions.assertEquals("ibnuqqkpik", model.metricRules().userEmail()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TagRuleUpdatePropertiesInner model = + new TagRuleUpdatePropertiesInner() + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.DISABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.ENABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("ljkyqxjvuuj") + .withValue("idokgjlj") + .withAction(TagAction.INCLUDE), + new FilteringTag() + .withName("vcltbgsncgh") + .withValue("esz") + .withAction(TagAction.EXCLUDE)))) + .withMetricRules( + new MetricRulesInner() + .withSendMetrics(SendMetricsStatus.DISABLED) + .withFilteringTags( + Arrays + .asList( + new FilteringTag() + .withName("vgxbfs") + .withValue("nehmpvecx") + .withAction(TagAction.EXCLUDE), + new FilteringTag() + .withName("bfqkkr") + .withValue("pukgriwflzlfb") + .withAction(TagAction.INCLUDE), + new FilteringTag() + .withName("zycispn") + .withValue("ahmgkbrp") + .withAction(TagAction.INCLUDE))) + .withUserEmail("ibnuqqkpik")); + model = BinaryData.fromObject(model).toObject(TagRuleUpdatePropertiesInner.class); + Assertions.assertEquals(SendAadLogsStatus.DISABLED, model.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, model.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.ENABLED, model.logRules().sendActivityLogs()); + Assertions.assertEquals("ljkyqxjvuuj", model.logRules().filteringTags().get(0).name()); + Assertions.assertEquals("idokgjlj", model.logRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.INCLUDE, model.logRules().filteringTags().get(0).action()); + Assertions.assertEquals(SendMetricsStatus.DISABLED, model.metricRules().sendMetrics()); + Assertions.assertEquals("vgxbfs", model.metricRules().filteringTags().get(0).name()); + Assertions.assertEquals("nehmpvecx", model.metricRules().filteringTags().get(0).value()); + Assertions.assertEquals(TagAction.EXCLUDE, model.metricRules().filteringTags().get(0).action()); + Assertions.assertEquals("ibnuqqkpik", model.metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesCreateOrUpdateMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..2aa11b823552f --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesCreateOrUpdateMockTests.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.fluent.models.MetricRulesInner; +import com.azure.resourcemanager.newrelicobservability.models.LogRules; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TagRulesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"logRules\":{\"sendAadLogs\":\"Enabled\",\"sendSubscriptionLogs\":\"Disabled\",\"sendActivityLogs\":\"Enabled\",\"filteringTags\":[]},\"metricRules\":{\"sendMetrics\":\"Disabled\",\"filteringTags\":[],\"userEmail\":\"qrhzoymibmrqyib\"}},\"id\":\"wfluszdt\",\"name\":\"hrkwo\",\"type\":\"yyv\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TagRule response = + manager + .tagRules() + .define("ksmond") + .withExistingMonitor("ouyftaakc", "wiyzvqtmnubexkp") + .withLogRules( + new LogRules() + .withSendAadLogs(SendAadLogsStatus.DISABLED) + .withSendSubscriptionLogs(SendSubscriptionLogsStatus.DISABLED) + .withSendActivityLogs(SendActivityLogsStatus.ENABLED) + .withFilteringTags(Arrays.asList())) + .withMetricRules( + new MetricRulesInner() + .withSendMetrics(SendMetricsStatus.DISABLED) + .withFilteringTags(Arrays.asList()) + .withUserEmail("hojvpajqgxysmocm")) + .create(); + + Assertions.assertEquals(SendAadLogsStatus.ENABLED, response.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.DISABLED, response.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.ENABLED, response.logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.DISABLED, response.metricRules().sendMetrics()); + Assertions.assertEquals("qrhzoymibmrqyib", response.metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesDeleteMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesDeleteMockTests.java new file mode 100644 index 0000000000000..6d01ebe7e3e7c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesDeleteMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TagRulesDeleteMockTests { + @Test + public void testDelete() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = "{}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.tagRules().delete("zl", "mbmpaxmodfvuefy", "sbpfvmwyhr", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesGetWithResponseMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesGetWithResponseMockTests.java new file mode 100644 index 0000000000000..a6c4b6145318c --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesGetWithResponseMockTests.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TagRulesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"properties\":{\"provisioningState\":\"Creating\",\"logRules\":{\"sendAadLogs\":\"Disabled\",\"sendSubscriptionLogs\":\"Enabled\",\"sendActivityLogs\":\"Disabled\",\"filteringTags\":[]},\"metricRules\":{\"sendMetrics\":\"Disabled\",\"filteringTags\":[],\"userEmail\":\"utwu\"}},\"id\":\"grpkhjwniyqs\",\"name\":\"uicpd\",\"type\":\"gk\"}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + TagRule response = + manager + .tagRules() + .getWithResponse("dcvd", "hvoodsotbobzd", "pcjwv", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(SendAadLogsStatus.DISABLED, response.logRules().sendAadLogs()); + Assertions.assertEquals(SendSubscriptionLogsStatus.ENABLED, response.logRules().sendSubscriptionLogs()); + Assertions.assertEquals(SendActivityLogsStatus.DISABLED, response.logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.DISABLED, response.metricRules().sendMetrics()); + Assertions.assertEquals("utwu", response.metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesListByNewRelicMonitorResourceMockTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesListByNewRelicMonitorResourceMockTests.java new file mode 100644 index 0000000000000..b01cb95140228 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/TagRulesListByNewRelicMonitorResourceMockTests.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.resourcemanager.newrelicobservability.NewRelicObservabilityManager; +import com.azure.resourcemanager.newrelicobservability.models.SendAadLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendActivityLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendMetricsStatus; +import com.azure.resourcemanager.newrelicobservability.models.SendSubscriptionLogsStatus; +import com.azure.resourcemanager.newrelicobservability.models.TagRule; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.Mockito; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +public final class TagRulesListByNewRelicMonitorResourceMockTests { + @Test + public void testListByNewRelicMonitorResource() throws Exception { + HttpClient httpClient = Mockito.mock(HttpClient.class); + HttpResponse httpResponse = Mockito.mock(HttpResponse.class); + ArgumentCaptor httpRequest = ArgumentCaptor.forClass(HttpRequest.class); + + String responseStr = + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"logRules\":{\"sendAadLogs\":\"Disabled\",\"sendSubscriptionLogs\":\"Disabled\",\"sendActivityLogs\":\"Disabled\",\"filteringTags\":[]},\"metricRules\":{\"sendMetrics\":\"Enabled\",\"filteringTags\":[],\"userEmail\":\"fuflrwdmhdlx\"}},\"id\":\"rxsagafcnihgwqa\",\"name\":\"nedgfbc\",\"type\":\"kcvqvpke\"}]}"; + + Mockito.when(httpResponse.getStatusCode()).thenReturn(200); + Mockito.when(httpResponse.getHeaders()).thenReturn(new HttpHeaders()); + Mockito + .when(httpResponse.getBody()) + .thenReturn(Flux.just(ByteBuffer.wrap(responseStr.getBytes(StandardCharsets.UTF_8)))); + Mockito + .when(httpResponse.getBodyAsByteArray()) + .thenReturn(Mono.just(responseStr.getBytes(StandardCharsets.UTF_8))); + Mockito + .when(httpClient.send(httpRequest.capture(), Mockito.any())) + .thenReturn( + Mono + .defer( + () -> { + Mockito.when(httpResponse.getRequest()).thenReturn(httpRequest.getValue()); + return Mono.just(httpResponse); + })); + + NewRelicObservabilityManager manager = + NewRelicObservabilityManager + .configure() + .withHttpClient(httpClient) + .authenticate( + tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = + manager + .tagRules() + .listByNewRelicMonitorResource("wdsjnkalju", "iiswacffgdkzze", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(SendAadLogsStatus.DISABLED, response.iterator().next().logRules().sendAadLogs()); + Assertions + .assertEquals( + SendSubscriptionLogsStatus.DISABLED, response.iterator().next().logRules().sendSubscriptionLogs()); + Assertions + .assertEquals(SendActivityLogsStatus.DISABLED, response.iterator().next().logRules().sendActivityLogs()); + Assertions.assertEquals(SendMetricsStatus.ENABLED, response.iterator().next().metricRules().sendMetrics()); + Assertions.assertEquals("fuflrwdmhdlx", response.iterator().next().metricRules().userEmail()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/UserAssignedIdentityTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/UserAssignedIdentityTests.java new file mode 100644 index 0000000000000..e25eada855f96 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/UserAssignedIdentityTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = + BinaryData + .fromString( + "{\"principalId\":\"0788ae95-8898-400e-843e-d9d894d9190d\",\"clientId\":\"2ffb5be1-8a16-4713-9491-5b5fc922e623\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/UserInfoTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/UserInfoTests.java new file mode 100644 index 0000000000000..616acfe584a52 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/UserInfoTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.models.UserInfo; +import org.junit.jupiter.api.Assertions; + +public final class UserInfoTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserInfo model = + BinaryData + .fromString( + "{\"firstName\":\"fvzwdzuhty\",\"lastName\":\"isdkfthwxmnteiw\",\"emailAddress\":\"pvkmijcmmxdcuf\",\"phoneNumber\":\"srp\",\"country\":\"zidnsezcxtbzsgfy\"}") + .toObject(UserInfo.class); + Assertions.assertEquals("fvzwdzuhty", model.firstName()); + Assertions.assertEquals("isdkfthwxmnteiw", model.lastName()); + Assertions.assertEquals("pvkmijcmmxdcuf", model.emailAddress()); + Assertions.assertEquals("srp", model.phoneNumber()); + Assertions.assertEquals("zidnsezcxtbzsgfy", model.country()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserInfo model = + new UserInfo() + .withFirstName("fvzwdzuhty") + .withLastName("isdkfthwxmnteiw") + .withEmailAddress("pvkmijcmmxdcuf") + .withPhoneNumber("srp") + .withCountry("zidnsezcxtbzsgfy"); + model = BinaryData.fromObject(model).toObject(UserInfo.class); + Assertions.assertEquals("fvzwdzuhty", model.firstName()); + Assertions.assertEquals("isdkfthwxmnteiw", model.lastName()); + Assertions.assertEquals("pvkmijcmmxdcuf", model.emailAddress()); + Assertions.assertEquals("srp", model.phoneNumber()); + Assertions.assertEquals("zidnsezcxtbzsgfy", model.country()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/VMHostsListResponseTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/VMHostsListResponseTests.java new file mode 100644 index 0000000000000..c3077072d3127 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/VMHostsListResponseTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import com.azure.resourcemanager.newrelicobservability.models.VMHostsListResponse; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class VMHostsListResponseTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMHostsListResponse model = + BinaryData + .fromString( + "{\"value\":[{\"vmId\":\"ounqecano\",\"agentVersion\":\"upfh\",\"agentStatus\":\"ltrpmopj\"}],\"nextLink\":\"matuok\"}") + .toObject(VMHostsListResponse.class); + Assertions.assertEquals("ounqecano", model.value().get(0).vmId()); + Assertions.assertEquals("upfh", model.value().get(0).agentVersion()); + Assertions.assertEquals("ltrpmopj", model.value().get(0).agentStatus()); + Assertions.assertEquals("matuok", model.nextLink()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMHostsListResponse model = + new VMHostsListResponse() + .withValue( + Arrays + .asList( + new VMInfoInner() + .withVmId("ounqecano") + .withAgentVersion("upfh") + .withAgentStatus("ltrpmopj"))) + .withNextLink("matuok"); + model = BinaryData.fromObject(model).toObject(VMHostsListResponse.class); + Assertions.assertEquals("ounqecano", model.value().get(0).vmId()); + Assertions.assertEquals("upfh", model.value().get(0).agentVersion()); + Assertions.assertEquals("ltrpmopj", model.value().get(0).agentStatus()); + Assertions.assertEquals("matuok", model.nextLink()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/VMInfoInnerTests.java b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/VMInfoInnerTests.java new file mode 100644 index 0000000000000..8679fe6298854 --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/java/com/azure/resourcemanager/newrelicobservability/generated/VMInfoInnerTests.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.newrelicobservability.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.newrelicobservability.fluent.models.VMInfoInner; +import org.junit.jupiter.api.Assertions; + +public final class VMInfoInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VMInfoInner model = + BinaryData + .fromString("{\"vmId\":\"fu\",\"agentVersion\":\"aodsfcpkv\",\"agentStatus\":\"dpuozmyz\"}") + .toObject(VMInfoInner.class); + Assertions.assertEquals("fu", model.vmId()); + Assertions.assertEquals("aodsfcpkv", model.agentVersion()); + Assertions.assertEquals("dpuozmyz", model.agentStatus()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VMInfoInner model = new VMInfoInner().withVmId("fu").withAgentVersion("aodsfcpkv").withAgentStatus("dpuozmyz"); + model = BinaryData.fromObject(model).toObject(VMInfoInner.class); + Assertions.assertEquals("fu", model.vmId()); + Assertions.assertEquals("aodsfcpkv", model.agentVersion()); + Assertions.assertEquals("dpuozmyz", model.agentStatus()); + } +} diff --git a/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 0000000000000..1f0955d450f0d --- /dev/null +++ b/sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline diff --git a/sdk/newrelicobservability/ci.yml b/sdk/newrelicobservability/ci.yml new file mode 100644 index 0000000000000..ceb8f549b4af1 --- /dev/null +++ b/sdk/newrelicobservability/ci.yml @@ -0,0 +1,47 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/newrelicobservability/ci.yml + - sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/ + exclude: + - sdk/newrelicobservability/pom.xml + - sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/newrelicobservability/ci.yml + - sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/ + exclude: + - sdk/newrelicobservability/pom.xml + - sdk/newrelicobservability/azure-resourcemanager-newrelicobservability/pom.xml + +parameters: + - name: release_azureresourcemanagernewrelicobservability + displayName: azure-resourcemanager-newrelicobservability + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: newrelicobservability + EnableBatchRelease: true + Artifacts: + - name: azure-resourcemanager-newrelicobservability + groupId: com.azure.resourcemanager + safeName: azureresourcemanagernewrelicobservability + releaseInBatch: ${{ parameters.release_azureresourcemanagernewrelicobservability }} diff --git a/sdk/newrelicobservability/pom.xml b/sdk/newrelicobservability/pom.xml new file mode 100644 index 0000000000000..9869b4a4c1335 --- /dev/null +++ b/sdk/newrelicobservability/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-newrelicobservability-service + pom + 1.0.0 + + + azure-resourcemanager-newrelicobservability + + diff --git a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md index 139d92b3ad4c9..a0b0642c95922 100644 --- a/sdk/storage/azure-storage-blob-batch/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-batch/CHANGELOG.md @@ -1,9 +1,8 @@ # Release History -## 12.18.0-beta.1 (Unreleased) +## 12.18.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. ### Breaking Changes @@ -11,6 +10,11 @@ ### Other Changes +## 12.18.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. + ## 12.17.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-blob-batch/README.md b/sdk/storage/azure-storage-blob-batch/README.md index f64235e458ccc..0252a6f7a07c9 100644 --- a/sdk/storage/azure-storage-blob-batch/README.md +++ b/sdk/storage/azure-storage-blob-batch/README.md @@ -55,7 +55,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-blob-batch - 12.17.1 + 12.18.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-blob-batch/pom.xml b/sdk/storage/azure-storage-blob-batch/pom.xml index fd79b5aa47b91..094319b1355fd 100644 --- a/sdk/storage/azure-storage-blob-batch/pom.xml +++ b/sdk/storage/azure-storage-blob-batch/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob-batch - 12.18.0-beta.1 + 12.18.0-beta.2 Microsoft Azure client library for Blob Storage batching This module contains client library for Microsoft Azure Blob Storage batching. @@ -78,7 +78,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 @@ -100,7 +100,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-blob-changefeed/pom.xml b/sdk/storage/azure-storage-blob-changefeed/pom.xml index e64dc30d3cd25..df114485213aa 100644 --- a/sdk/storage/azure-storage-blob-changefeed/pom.xml +++ b/sdk/storage/azure-storage-blob-changefeed/pom.xml @@ -84,7 +84,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 @@ -106,7 +106,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md index 658659cbdac86..2797a48f43419 100644 --- a/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob-cryptography/CHANGELOG.md @@ -1,9 +1,8 @@ # Release History -## 12.21.0-beta.1 (Unreleased) +## 12.21.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. ### Breaking Changes @@ -11,6 +10,11 @@ ### Other Changes +## 12.21.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. + ## 12.20.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-blob-cryptography/README.md b/sdk/storage/azure-storage-blob-cryptography/README.md index d409c5528b481..ae8f2bdcc96d3 100644 --- a/sdk/storage/azure-storage-blob-cryptography/README.md +++ b/sdk/storage/azure-storage-blob-cryptography/README.md @@ -57,7 +57,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-blob-cryptography - 12.20.1 + 12.21.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-blob-cryptography/pom.xml b/sdk/storage/azure-storage-blob-cryptography/pom.xml index e0900b467c359..46ab9e2b34d88 100644 --- a/sdk/storage/azure-storage-blob-cryptography/pom.xml +++ b/sdk/storage/azure-storage-blob-cryptography/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob-cryptography - 12.21.0-beta.1 + 12.21.0-beta.2 Microsoft Azure client library for Blob Storage cryptography This module contains client library for Microsoft Azure Blob Storage cryptography. @@ -62,7 +62,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 @@ -74,7 +74,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-blob-nio/pom.xml b/sdk/storage/azure-storage-blob-nio/pom.xml index 0bccf7ff126d1..e728a0cff188e 100644 --- a/sdk/storage/azure-storage-blob-nio/pom.xml +++ b/sdk/storage/azure-storage-blob-nio/pom.xml @@ -77,7 +77,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 @@ -89,7 +89,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-blob/CHANGELOG.md b/sdk/storage/azure-storage-blob/CHANGELOG.md index 83d819614b93c..ae1ba3918d038 100644 --- a/sdk/storage/azure-storage-blob/CHANGELOG.md +++ b/sdk/storage/azure-storage-blob/CHANGELOG.md @@ -1,17 +1,23 @@ # Release History -## 12.22.0-beta.1 (Unreleased) +## 12.22.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. ### Breaking Changes ### Bugs Fixed -- Fixed bug for when `FindBlobsOptions.setMaxResultsPerPage(Integer)` was set and `.byPage()` was called on `BlobServiceAsyncClient.findBlobsByTags(FindBlobsOptions)`, number of results being returned was greater than the specified max results. ### Other Changes +## 12.22.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. + +### Bugs Fixed +- Fixed bug for when `FindBlobsOptions.setMaxResultsPerPage(Integer)` was set and `.byPage()` was called on `BlobServiceAsyncClient.findBlobsByTags(FindBlobsOptions)`, number of results being returned was greater than the specified max results. + ## 12.21.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-blob/README.md b/sdk/storage/azure-storage-blob/README.md index 15fd6e56f7056..75480b85b5cdb 100644 --- a/sdk/storage/azure-storage-blob/README.md +++ b/sdk/storage/azure-storage-blob/README.md @@ -55,7 +55,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-blob - 12.21.1 + 12.22.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-blob/pom.xml b/sdk/storage/azure-storage-blob/pom.xml index 8a17129bef8c0..8df0847b691cd 100644 --- a/sdk/storage/azure-storage-blob/pom.xml +++ b/sdk/storage/azure-storage-blob/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 Microsoft Azure client library for Blob Storage This module contains client library for Microsoft Azure Blob Storage. @@ -86,12 +86,12 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 com.azure azure-storage-internal-avro - 12.7.0-beta.1 + 12.7.0-beta.2 @@ -112,7 +112,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-common/CHANGELOG.md b/sdk/storage/azure-storage-common/CHANGELOG.md index 8cf3f6f0ce600..b0f28d0251171 100644 --- a/sdk/storage/azure-storage-common/CHANGELOG.md +++ b/sdk/storage/azure-storage-common/CHANGELOG.md @@ -1,9 +1,8 @@ # Release History -## 12.21.0-beta.1 (Unreleased) +## 12.21.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. ### Breaking Changes @@ -11,6 +10,11 @@ ### Other Changes +## 12.21.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. + ## 12.20.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-common/README.md b/sdk/storage/azure-storage-common/README.md index 8414d6324afbb..f69594540f98d 100644 --- a/sdk/storage/azure-storage-common/README.md +++ b/sdk/storage/azure-storage-common/README.md @@ -52,7 +52,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-common - 12.20.1 + 12.21.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-common/pom.xml b/sdk/storage/azure-storage-common/pom.xml index cc6b82aac6a03..067e33ab55ee5 100644 --- a/sdk/storage/azure-storage-common/pom.xml +++ b/sdk/storage/azure-storage-common/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 Microsoft Azure common module for Storage This module contains common code based for all Microsoft Azure Storage client libraries. diff --git a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md index c81ceb2aadd99..d1736c0503bb5 100644 --- a/sdk/storage/azure-storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-datalake/CHANGELOG.md @@ -1,12 +1,8 @@ # Release History -## 12.15.0-beta.1 (Unreleased) +## 12.15.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. -- Adding support for Encryption Context on DataLake files, a string value that can be passed to allow users to generate -file-level encryption keys. This value is returned on `DataLakeFileClient.getProperties()`, `DataLakeFileClient.readWithResponse()`, -and `DataLakeFileClient.listPaths()`. ### Breaking Changes @@ -14,6 +10,14 @@ and `DataLakeFileClient.listPaths()`. ### Other Changes +## 12.15.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. +- Adding support for Encryption Context on DataLake files, a string value that can be passed to allow users to generate +file-level encryption keys. This value is returned on `DataLakeFileClient.getProperties()`, `DataLakeFileClient.readWithResponse()`, +and `DataLakeFileClient.listPaths()`. + ## 12.14.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-file-datalake/README.md b/sdk/storage/azure-storage-file-datalake/README.md index bb29ddcc9db4d..93beec7a862fa 100644 --- a/sdk/storage/azure-storage-file-datalake/README.md +++ b/sdk/storage/azure-storage-file-datalake/README.md @@ -56,7 +56,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-file-datalake - 12.14.1 + 12.15.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-file-datalake/pom.xml b/sdk/storage/azure-storage-file-datalake/pom.xml index df20e5cff784a..5ac0c806c95ee 100644 --- a/sdk/storage/azure-storage-file-datalake/pom.xml +++ b/sdk/storage/azure-storage-file-datalake/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file-datalake - 12.15.0-beta.1 + 12.15.0-beta.2 Microsoft Azure client library for File Storage Data Lake This module contains client library for Microsoft Azure File Storage Data Lake. @@ -84,7 +84,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 @@ -106,7 +106,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-file-share/CHANGELOG.md b/sdk/storage/azure-storage-file-share/CHANGELOG.md index 1d92e61707c7d..273f25aaa0c13 100644 --- a/sdk/storage/azure-storage-file-share/CHANGELOG.md +++ b/sdk/storage/azure-storage-file-share/CHANGELOG.md @@ -1,6 +1,16 @@ # Release History -## 12.18.0-beta.1 (Unreleased) +## 12.18.0-beta.2 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes + +## 12.18.0-beta.1 (2023-03-28) ### Features Added - Added support for 2022-11-02 service version. @@ -11,12 +21,6 @@ only supported for certain operations in the Data Plane SDK. provided, the service will not silently remove any trailing `.` character from directory/file names for all operations made from that client. `allowSourceTrailingDot` will apply this same rule to source files when performing a rename or copy operation. -### Breaking Changes - -### Bugs Fixed - -### Other Changes - ## 12.17.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-file-share/README.md b/sdk/storage/azure-storage-file-share/README.md index 542f39c00e968..fabd9dedee56a 100644 --- a/sdk/storage/azure-storage-file-share/README.md +++ b/sdk/storage/azure-storage-file-share/README.md @@ -59,7 +59,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-file-share - 12.17.1 + 12.18.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-file-share/pom.xml b/sdk/storage/azure-storage-file-share/pom.xml index af2822da06131..02dc54ff6471c 100644 --- a/sdk/storage/azure-storage-file-share/pom.xml +++ b/sdk/storage/azure-storage-file-share/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-file-share - 12.18.0-beta.1 + 12.18.0-beta.2 Microsoft Azure client library for File Share Storage This module contains client library for Microsoft Azure File Share Storage. @@ -64,7 +64,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 @@ -76,7 +76,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test @@ -113,7 +113,7 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 test diff --git a/sdk/storage/azure-storage-internal-avro/CHANGELOG.md b/sdk/storage/azure-storage-internal-avro/CHANGELOG.md index 7b14dc13a14c8..1b84fc02a9723 100644 --- a/sdk/storage/azure-storage-internal-avro/CHANGELOG.md +++ b/sdk/storage/azure-storage-internal-avro/CHANGELOG.md @@ -1,9 +1,8 @@ # Release History -## 12.7.0-beta.1 (Unreleased) +## 12.7.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. ### Breaking Changes @@ -11,6 +10,11 @@ ### Other Changes +## 12.7.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. + ## 12.6.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-internal-avro/pom.xml b/sdk/storage/azure-storage-internal-avro/pom.xml index f32dd462b98a0..11d645fadd9ad 100644 --- a/sdk/storage/azure-storage-internal-avro/pom.xml +++ b/sdk/storage/azure-storage-internal-avro/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-internal-avro - 12.7.0-beta.1 + 12.7.0-beta.2 Microsoft Azure internal Avro module for Storage This module contains internal use only avro parser code based for Microsoft Azure Storage client libraries. @@ -57,7 +57,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 @@ -75,7 +75,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test diff --git a/sdk/storage/azure-storage-perf/pom.xml b/sdk/storage/azure-storage-perf/pom.xml index 90457325b44d2..ea43cbf940d2c 100644 --- a/sdk/storage/azure-storage-perf/pom.xml +++ b/sdk/storage/azure-storage-perf/pom.xml @@ -25,25 +25,25 @@ com.azure azure-storage-blob - 12.22.0-beta.1 + 12.22.0-beta.2 com.azure azure-storage-blob-cryptography - 12.21.0-beta.1 + 12.21.0-beta.2 com.azure azure-storage-file-datalake - 12.15.0-beta.1 + 12.15.0-beta.2 com.azure azure-storage-file-share - 12.18.0-beta.1 + 12.18.0-beta.2 diff --git a/sdk/storage/azure-storage-queue/CHANGELOG.md b/sdk/storage/azure-storage-queue/CHANGELOG.md index ad5a2f0c625d5..9d41ce46d7cfc 100644 --- a/sdk/storage/azure-storage-queue/CHANGELOG.md +++ b/sdk/storage/azure-storage-queue/CHANGELOG.md @@ -1,9 +1,8 @@ # Release History -## 12.17.0-beta.1 (Unreleased) +## 12.17.0-beta.2 (Unreleased) ### Features Added -- Added support for 2022-11-02 service version. ### Breaking Changes @@ -11,6 +10,11 @@ ### Other Changes +## 12.17.0-beta.1 (2023-03-28) + +### Features Added +- Added support for 2022-11-02 service version. + ## 12.16.1 (2023-03-16) ### Other Changes diff --git a/sdk/storage/azure-storage-queue/README.md b/sdk/storage/azure-storage-queue/README.md index cc86bcab8e2be..5c46048e4c5d2 100644 --- a/sdk/storage/azure-storage-queue/README.md +++ b/sdk/storage/azure-storage-queue/README.md @@ -53,7 +53,7 @@ add the direct dependency to your project as follows. com.azure azure-storage-queue - 12.16.1 + 12.17.0-beta.1 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/storage/azure-storage-queue/pom.xml b/sdk/storage/azure-storage-queue/pom.xml index acd82f423324f..2fe4909ecaabf 100644 --- a/sdk/storage/azure-storage-queue/pom.xml +++ b/sdk/storage/azure-storage-queue/pom.xml @@ -13,7 +13,7 @@ com.azure azure-storage-queue - 12.17.0-beta.1 + 12.17.0-beta.2 Microsoft Azure client library for Queue Storage This module contains client library for Microsoft Azure Queue Storage. @@ -62,7 +62,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 @@ -74,7 +74,7 @@ com.azure azure-storage-common - 12.21.0-beta.1 + 12.21.0-beta.2 tests test-jar test